Forum Discussion
How to dynamically modify a Measure result based on a specific value?
Hello,
I'm trying to create a Measure, which calculation should be dynamically impacted based on a column value.
To illustrate, here's the "default" mesure I'm using:
Measure = CALCULATE(sum(AllWorkItems[Effort]),AllWorkItems[State]="Done")
In which context do you want your measure? Can you please make this more clear for me, please?
You can try this:Measure = IF(MAX('Table'[Wi])="Bug",CALCULATE(sum('Table'[Effort]),'Table'[State]="Done")+100,CALCULATE(sum('Table'[Effort]),'Table'[State]="Done"))
Be aware of the measure you use sum instead of sumx.
5 Replies
- andhiii079845
Solution Sage
In which context do you want your measure? Can you please make this more clear for me, please?
You can try this:Measure = IF(MAX('Table'[Wi])="Bug",CALCULATE(sum('Table'[Effort]),'Table'[State]="Done")+100,CALCULATE(sum('Table'[Effort]),'Table'[State]="Done"))
Be aware of the measure you use sum instead of sumx.- DorisCMooreFrequent Visitor
Works like a charm, thank you so much!! 😊
- andhiii079845
Solution Sage
Use a VAR and RETURN construct:
Mymeasure =
Var _firstmeasure = CALCULATE(sum(AllWorkItems[Effort]),AllWorkItems[State]="Done")
Var *The WI BUG*
Return iif()
- DorisCMooreFrequent Visitor
Thank you for the proposition but var WIbug = AllWorkItems[WI] = "Bug" is probably what bothers me since the begining. As WI is a string value, I'm always gettig a "cannot find name" kind of error.
Maybe this is how I should have put the question: how can we manipulate strings in a measure?
- andhiii079845
Solution Sage
Do you have some example data?