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.
My two tables are simple. Invoicelines with dates that are related to GLDates that returns our accounting periods.
This will work perfectly :
_ytd sales = CALCULATE( sum(Invoicelines[usd_val]) , GLDates[PDNUM] = 10 )
whereas this:
_ytd sales = CALCULATE( sum(Invoicelines[usd_val]) , GLDates[PDNUM] = [Actual Max open PD])
fails like so: "A function 'CALCULATE' has been used in a True/False expression that is used as a table filter expression. This is not allowed."
My measure (which correctly returns the number 10) is here:
Actual Max open PD = calculate(max(GLDates[PD] ) , GLDates[PERIOD_STATUS] = "O")
FWIW I did somewhat better when I did "Calculate( Sum() , Filter() etc... but was not able to get what I really wanted which is actually TWO filters on the Sum of USD_VAL . One for the Current Period, and another for the Current Year.
If anyone can point me in a better direction than the way I am heading I would really appreciate the help. I have been looking at this for so long now that I simply cannot see the way forward.
Thanks....
Solved! Go to Solution.
Please See if this works
_ytd sales = VAR mymeasure = [Actual Max open PD] RETURN CALCULATE ( SUM ( Invoicelines[usd_val] ), GLDates[PDNUM] = mymeasure )
Please See if this works
_ytd sales = VAR mymeasure = [Actual Max open PD] RETURN CALCULATE ( SUM ( Invoicelines[usd_val] ), GLDates[PDNUM] = mymeasure )
Well yes it seems to work, thanks for the incredibly fast response.
To understand this better though: In order to use a measure in this way I am supposed to assign it to a VAR and then refer to that VAR?
I never would have stumbled upon that, I think I shall have to research VAR usage...
Thanks very much.
Hi @Quindici
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
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 |
---|---|
115 | |
99 | |
86 | |
70 | |
62 |
User | Count |
---|---|
151 | |
120 | |
103 | |
87 | |
68 |