Summing up the Created Measure on a Card Visual

Viewed 141

This is my data,

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

I have a PBI Table produced like this,

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

On the table Last_Processed_Date is a Measure Created in PBI - using something like this.

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

Days Diff is written as a measure using something like this.

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

There is a parameter slicer, that is passed that will select the required days diff and it ranges from 1 to 100.

In this case, the user has 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

So, upto now it works and produces the table like above and it is dynamic when the user adjusts the Input parameter - the value of MyMeasure changes accordingly as expected.

But now, I want to produce a card visual that says '2'. This is nothing but the Sum of MyMeasure or the count of App_Numbers that is with in the expected date diff. I tried to do this using the created MyMeasure as a visual level filter on the card, but it isn't working. How do we resolve this Issue ?

1 Answers

Below measure will sum the mymeasure value.

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))

enter image description here

Related