在卡片视觉上总结创建的度量

Summing up the Created Measure on a Card Visual

这是我的数据,

App_Num Processed_Date State
A1      10 Feb 2021     Open
A1      10 Feb 2021     Closed
A1      22 Feb 2021     Closed
A2      22 Feb 2021     Closed
A2      20 Feb 2021     Closed
A2      21 Feb 2021     Open
A3      20 Feb 2021     Open
A4      20 Feb 2021     Open
A7      20 Feb 2021     Open

我有一个 PBI Table 是这样制作的,

App_Num  Last_Processed_Date     Days Diff    MyMeasure   HasOpenTransactions             
A1       22 Feb 2021                 2             1            1
A2       21 Feb 2021                 3             1            1
A3       20 Feb 2021                 4             0            0
A4       20 Feb 2021                 4             0            0
A7       20 Feb 2021                 4             0            0

在table Last_Processed_Date 是在 PBI 中创建的度量 - 使用类似这样的东西。

Last_Processed_Date = calculate (max(processed_date),filter(table1, app_num = selectedvalue(app_num)

天差是使用类似这样的方法写成的度量。

Days Diff = var selected_app_num = selectedvalue(app_num)
            var last_processed_date = calculate (max(processed_date),filter(table1, app_num = selected_app_num))
var days_diff_req = datediff(last_processed_date, today(),day)
return days_diff_req

有一个参数切片器,传递的参数将 select 所需的天数差异,范围从 1 到 100。

在这种情况下,用户 selected 3.

MyMeasure = var selected_app_num = selectedvalue(app_num)
            var last_processed_date = calculate (max(processed_date),filter(table1, app_num = selected_app_num))
var days_diff_req = datediff(last_processed_date, today(),day)
var required = if(days_diff_req <= selectedvalue(Parameter),1,0)
return required

Today () in the above formula refers to 24/02/2021

所以,到目前为止,它可以正常工作并生成上面的 table,并且当用户调整输入参数时它是动态的 - MyMeasure 的值会按预期相应地改变。

但现在,我想制作一个卡片视觉效果,上面写着“2”。这只不过是预期日期差异中包含的 MyMeasure 的总和或 App_Numbers 的计数。我尝试使用创建的 MyMeasure 作为卡片上的视觉级别过滤器来执行此操作,但它不起作用。我们如何解决这个问题?

低于测量值将对 mymeasure 值求和。

cards_measure = var _APP_NUM = ALLSELECTED(app_table[App_Num]) RETURN SUMX(VALUES(app_table[App_Num]),if(app_table[App_Num]in (_APP_NUM),[MyMeasure],0))