Forum Discussion
Using a Measure as a filter in DAX formula
- 8 years ago
Anonymous
Try this
Greater Count (Measure) = VAR myranking = [Ranking Score] RETURN CALCULATE ( COUNT ( predicted[global_site_id] ), FILTER ( predicted, predicted[Score 0_100] > myranking ) )
Zubair_Muhammad Thank you, that works perfectly!
Can you tell me why this approach works but what I had attempted does not?
Hi Anonymous
Measures are dynamic....Inside an ITERATOR like FILTER/SUMX etc they behave according to the context of the (temporary) Table used as FirstArgument of these iterators.....
In your case you want the MEASURE value to be based on the CONTEXT provided by your Pivot Table or Table or Matrix Visualization (NOT the TABLE created by FILTER function).....so you have to take the Measure out of the Filter Function.....
So this is what we did...First Stored the Value of MEASURE using a VARiable and then used this VARiable inside FILTER function
- Veles7 years agoAdvocate V
Thanks Zubair_Muhammad that has been very helpful, couldn't figure out why my formula wasn't working as intended.
- Anonymous8 years agoNot applicable
- Anonymous7 years agoNot applicable
aaargh!
Thanks for your solution!
I had the problem that, my first measure [ACT], done with Sumx, was not considered by my second measure in which i had Sumx and Filter (or even calculate as a try). So a problem of context transition. By the way, this article helped me too: https://blog.enterprisedna.co/2016/08/03/what-is-context-transition-and-why-does-it-matter/
The solution then for me was to call the first measure via a variable (var vACT = [ACT]
Br, G-