Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Measures and slicers not cooperating

Hi, 

In the following scenario there are two attribute columns -> AsSTR is a function of AsINT (equals "Newest" for 0, "Previous" for 1 and "x days old" for x!=0 or 1).

2019-11-28_09h20_26.png

I have added two simple measures that does the same filtering and summarization but based on different of those two attributes.

2019-11-28_09h20_46.png

2019-11-28_09h20_56.png

 

Having created two slicers that filters a visual, I have added 3 value columns: Sum of VALUE, and those measures.If I select 0 or 1 (or "Newest" and "Previous") everything seems ok - as expected, all the columns show the same value:

2019-11-28_09h22_40.png

 

 

 

 

 

 

 

However, if I choose only one of values demanded by Measure DAX filtering, or value that is not intersecting it gives me unexpected results. Moreover it seems that AsINT is not filtering FilterINT but FilterSTR and opposite.

2019-11-28_09h42_25.png

Above I would expect all coulmns to show 21338.

2019-11-28_09h22_50.png

2019-11-28_09h23_10.png

 

 

 

 

 

 

 

On both above examples I would expect only VALUE column to appear.

Is something wrong with my understanding of this features?
The pbix and xls with data you can find on google drive.

Could anyone help here? 

 

1 ACCEPTED SOLUTION

Hi @Anonymous, 

 

The measure FilterSTR = CALCULATE(SUM(Sheet1[VALUE]), OR(Sheet1[AsSTR] = "Newest",Sheet1[AsSTR] = "Previous")) is equal

to FilterSTR = CALCULATE(SUM(Sheet1[VALUE]), FILTER(ALL(Sheet1[AsSTR]),OR(Sheet1[AsSTR] = "Newest",Sheet1[AsSTR] = "Previous"))). The measure calculates the expression based on the condition that the AsSTR is "Newest" or "Previous". 

 

As the AsINT column isn't used in filter argument within CALCULATE() function, when you select the value 5 in slicer AsINT, the condition will apply to the measure. See: https://docs.microsoft.com/en-us/dax/calculate-function-dax#remarks

 

Best Regards,
Qiuyun Yu 

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-qiuyu-msft
Community Support
Community Support

Hi @Anonymous, 

 

The DAX expression CALCULATE(SUM(Sheet1[VALUE]), OR(Sheet1[AsINT] = 0,Sheet1[AsINT] = 1)) is equal to CALCULATE(SUM(Sheet1[VALUE]),FILTER(ALL([AsINT]),OR(Sheet1[AsINT] = 0,Sheet1[AsINT] = 1))), so it doesn't accept filter condition from slicer selections. For more information, see: https://www.sqlbi.com/articles/filter-arguments-in-calculate/

 

In your scenario, please modify these two measures like below: 

 

FilterINT = CALCULATE(SUM(Sheet1[VALUE]), FILTER(Sheet1,OR(Sheet1[AsINT] = 0,Sheet1[AsINT] = 1)))
FilterSTR = CALCULATE(SUM(Sheet1[VALUE]), FILTER(Sheet1,or(Sheet1[AsSTR] = "Newest",Sheet1[AsSTR] = "Previous")))

 

q2.PNGq3.PNGq4.PNG

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi @v-qiuyu-msft,

Thank you for your reply. However, I still can't understand one thing. If both of the expressions are the same, why don't they behave the same way? Having selected "5", it is ignored by 'FilterINT' measure, as you described it. But it is not ignored by 'FilterSTR' measure.
This is the major problem that convinced me to post this.
Could you please explain that? 

Hi @Anonymous, 

 

The measure FilterSTR = CALCULATE(SUM(Sheet1[VALUE]), OR(Sheet1[AsSTR] = "Newest",Sheet1[AsSTR] = "Previous")) is equal

to FilterSTR = CALCULATE(SUM(Sheet1[VALUE]), FILTER(ALL(Sheet1[AsSTR]),OR(Sheet1[AsSTR] = "Newest",Sheet1[AsSTR] = "Previous"))). The measure calculates the expression based on the condition that the AsSTR is "Newest" or "Previous". 

 

As the AsINT column isn't used in filter argument within CALCULATE() function, when you select the value 5 in slicer AsINT, the condition will apply to the measure. See: https://docs.microsoft.com/en-us/dax/calculate-function-dax#remarks

 

Best Regards,
Qiuyun Yu 

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi @v-qiuyu-msft

Thanks for your help. It sounds logic now.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.