Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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).
I have added two simple measures that does the same filtering and summarization but based on different of those two attributes.
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:
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.
Above I would expect all coulmns to show 21338.
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?
Solved! Go to 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
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:
Best Regards,
Qiuyun Yu
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
99 | |
83 | |
70 | |
60 |
User | Count |
---|---|
150 | |
115 | |
104 | |
89 | |
65 |