cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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

Accepted Solutions
Moderator v-qiuyu-msft
Moderator

Re: Measures and slicers not cooperating

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
Moderator v-qiuyu-msft
Moderator

Re: Measures and slicers not cooperating

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

Re: Measures and slicers not cooperating

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? 

Moderator v-qiuyu-msft
Moderator

Re: Measures and slicers not cooperating

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

Anonymous
Not applicable

Re: Measures and slicers not cooperating

Hi @v-qiuyu-msft

Thanks for your help. It sounds logic now.

Helpful resources

Announcements
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors