0

我试图在同一列上找到两个过滤器的总和。我们可以使用FILTER关键字,但它需要太多时间。所以我做了以下事情,但似乎没有任何效果。第二个过滤器永远不会被应用。

1.

MEASURE pop_hd_new[Connectivity %] = CALCULATE(
DIVIDE(
CALCULATE(
       SUM(pop_hd_new[Connected]),
      'prodhier_new'[PROD_TYPE_DESC] in { "Client Solutions PBU", "Enterprise Solution Group PBU"})
   ,CALCULATE(
      SUM(pop_hd_new[SVC_TAG_CNT]),
       'prodhier_new'[PROD_TYPE_DESC] in {"Client Solutions PBU", "Enterprise Solution Group PBU"})
   ))  
MEASURE pop_hd_new[Connectivity %] = CALCULATE(
DIVIDE(
CALCULATE(
       SUM(pop_hd_new[Connected]),
       prodhier_new,'prodhier_new'[PROD_TYPE_DESC] = "Client Solutions PBU" || 'prodhier_new'[PROD_TYPE_DESC] = "Enterprise Solution Group PBU")
   ,CALCULATE(
      SUM(pop_hd_new[SVC_TAG_CNT]),
        prodhier_new,'prodhier_new'[PROD_TYPE_DESC] = "Client Solutions PBU" || 'prodhier_new'[PROD_TYPE_DESC] = "Enterprise Solution Group PBU")
   ))

请提出一些解决方案。

4

1 回答 1

0

您可以尝试对您的第一种方法进行重构:

MEASURE pop_hd_new[Connectivity %] =
    CALCULATE (
        DIVIDE ( SUM ( pop_hd_new[Connected] ), SUM ( pop_hd_new[SVC_TAG_CNT] ) ),
        'prodhier_new'[PROD_TYPE_DESC]
            IN { "Client Solutions PBU", "Enterprise Solution Group PBU" }
    )

自己检查它是否比这个 FILTER 版本更快或更慢:

MEASURE pop_hd_new[Connectivity %] =
    CALCULATE (
        DIVIDE ( SUM ( pop_hd_new[Connected] ), SUM ( pop_hd_new[SVC_TAG_CNT] ) ),
        FILTER (
            ALL ( 'prodhier_new'[PROD_TYPE_DESC] ),
            'prodhier_new'[PROD_TYPE_DESC] = "Client Solutions PBU"
                || 'prodhier_new'[PROD_TYPE_DESC] = "Enterprise Solution Group PBU"
        )
    )
于 2021-02-12T15:41:51.433 回答