简体   繁体   English

如何在 obiee 的左外连接的一部分中包含分析过滤器(左连接变为内连接)

[英]How to include filters of analysis in on part of the left outer join in obiee (left join becoming inner join)

Recently we had an issue of outer joins working as inner joins.最近我们遇到了一个外连接作为内连接的问题。 The steps we did were the following: 1.Created left outer join between dim table and fact table in BMM layer.我们所做的步骤如下: 1.在 BMM 层的暗表和事实表之间创建左外连接。 2.Created an analysis in OBIEE to check this join 3.Sql generated shows left outer join statement but filters that were used in OBIEE analysis are placed in where clause and left outer join is ignored. 2.在 OBIEE 中创建分析以检查此连接 3.Sql 生成显示左外连接语句,但在 OBIEE 分析中使用的过滤器放置在 where 子句中,左外连接被忽略。

Here is the SQL code generated:这是生成的 SQL 代码:

WITH SAWITH0 AS
 (select sum(T4110.SALDO_OUT_EQV) as c1,
         T5520.CAL_DAY as c2,
         T75347.LINE_CODE as c3,
         T75347.LINE_NAME as c4,
         T3160.CODE as c5
    from DM_CBM_T17_V T75347 /* D4703 Dm Cbm T17 */
    left outer join(DM_CALENDAR_V T5520 /* D03 Calendar */
   inner join(DM_FILIALS_V T3160 /* D04 Filials */Q
   inner join DM_COA_SALDO_V T4110 /* F02 Saldo Coa */
      On T3160.CODE = T4110.FILIAL_CODE) On T4110.OPER_DAY = T5520.CAL_DAY) On T4110.COA_CODE = T75347.COA_CODE
   where (T4110.OPER_DAY = TO_DATE('2021-05-06', 'YYYY-MM-DD') and
         T5520.CAL_DAY = TO_DATE('2021-05-06', 'YYYY-MM-DD'))
   group by T3160.CODE, T5520.CAL_DAY, T75347.LINE_CODE, T75347.LINE_NAME)
select D1.c1 as c1,
       D1.c2 as c2,
       D1.c3 as c3,
       D1.c4 as c4,
       D1.c5 as c5,
       D1.c6 as c6
  from (select 0     as c1,
               D1.c2 as c2,
               D1.c3 as c3,
               D1.c4 as c4,
               D1.c5 as c5,
               D1.c1 as c6
          from SAWITH0 D1
         order by c2, c5, c3, c4) D1
 where rownum <= 10000000

As you can see, the join between dim D4703 and fact F02 is created on coa_code column.如您所见,dim D4703 和事实 F02 之间的连接是在 coa_code 列上创建的。 Dimension D4703 has rows with null values on column coa_code.维度 D4703 在 coa_code 列上具有 null 值的行。 The logic we followed was that left outer join should return all rows from dim D4703 (including nulls) and only those rows from fact table that are matched.我们遵循的逻辑是左外连接应该返回dim D4703 中的所有行(包括空值),并且只返回事实表中匹配的那些行。 However, there sql query returns only matching rows.但是,有 sql 查询只返回匹配的行。 And when you put day filter in where clause inside on statement it is returning null values.当您将 day 过滤器放在语句中的 where 子句中时,它会返回 null 值。

So I wanted to ask how to make left outer join work as intended?所以我想问一下如何使左外连接按预期工作? Is there any option in Admin tool or anywhere else?管理工具或其他任何地方是否有任何选项?

We call this "preservation of the dimensions".我们称之为“尺寸保持”。 there are two ways to achieve this with OBIEE:使用 OBIEE 有两种方法可以实现这一目标:

1- using the full outer join, follow this article: 1-使用完整的外连接,按照这篇文章:

https://datacadamia.com/dat/obiee/obis/full_outer_join https://datacadamia.com/dat/obiee/obis/full_outer_join

2- the second is using a cross Join between the dimensions by adding a Fact table, follow this article: 2-第二个是通过添加事实表在维度之间使用交叉连接,请遵循这篇文章:

https://datacadamia.com/dat/obiee/obis/densification_repository?s[]=preservation&s[]=dimensions https://datacadamia.com/dat/obiee/obis/densification_repository?s[]=preservation&s[]=dimensions

My favorite is the second approach and this is my recommendation.我最喜欢的是第二种方法,这是我的建议。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM