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.
I am doing something like this -
Solved! Go to Solution.
Try storing the MEASURE value in a variable first
Revenue = VAR myMEASURE = [MonthYear] RETURN CALCULATE ( SUM ( fact[Revenue] ), FILTER ( fact, fact[fiscalMonth] = myMEASURE ) )
Hi @sqldev2017,
What do you want to use this measure for? what is the context and calculation you arre making on the other measure where this one is used?
Regards,
MFelix
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em Português
I simply want to return one string value from a table, based on a filter.... That filter will always return one string value (for that table).
I understand CALCULATE is only for numeric measures...
But in this instance CALCULATE also seems to return a string !
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsI am doing something pretty straightforward.
My first "calculated measure" "MonthYear" returns a value say = "December 2018"
I use this calculated measure "MonthYear" in a different calculated measure as a Filter parameter -
"Revenue" = CALCULATE(SUM(Revenue), FILTER("fact", fact.fiscalMonth = MonthYear))
I can verify that MonthYear measure actually returns "December 2018"
But Revenue measure returns a blank value.
When I replace the MonthYear parameter , with a hard coded value
"Revenue" = CALCULATE(SUM(Revenue), FILTER("fact", fact.fiscalMonth = "December 2018" )) - Now this returns proper revenue value.
I do not understand why this is happening ! This is just so Bizzare.
Try storing the MEASURE value in a variable first
Revenue = VAR myMEASURE = [MonthYear] RETURN CALCULATE ( SUM ( fact[Revenue] ), FILTER ( fact, fact[fiscalMonth] = myMEASURE ) )
That worked like a Charm.
Thank You.
Honestly, I was trying to do this FORMAT(Measure, "String") , that was not working.
This worked.
Glad it worked.
When you use a MEASURE inside a FILTER function, it is evaluated for each row of the Table inside FILTER function (in your case it is FACT table)
That's why we have to store its value first in a variable
FILTER ( fact, fact[fiscalMonth] = [Measure] ) )
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 |
---|---|
111 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
148 | |
111 | |
93 | |
84 | |
66 |