Forum Discussion
Formula in measure not working as expected
Yes. It's likely due to filter context complications.
If you expect [Fake Dispatched Available MW] to be the same value for each row you are iterating over in the FILTER, then the solution is simple; calculate it once rather than for each row:
Price Setter (With Asset Removal) =
VAR Fake = [Fake Dispatched Available MW]
RETURN
CALCULATE (
MIN ( MeritOrder[Price] ),
FILTER ( MeritOrder, Fake <= MeritOrder[Cumulative Available MW] )
)
If the measure should be dependent on the row context from the FILTER iterator, then things get more complicated.
- austinb975 years agoRegular Visitor
Thanks, however this does not appear to fix my issue with the BLANK getting returned. I just can't understand why Measure 2 works correctly and Measure 4 does not with essentially the same logic.
- AlexisOlson5 years ago
Super User
What if you replace [Fake Dispatched Available MW] with the hardcoded value 8953? Do you get a non-blank or are you just filtering out the whole table?
Note: You are playing with fire having ALLSELECTED inside of a FILTER iterator. ALLSELECTED is really complicated to understand in such situations.
- austinb975 years agoRegular Visitor
I appreciate the suggestion. You can see the result below, it does work as expected in this case. There is just some sort of issue with how the measure is being passed into this formula. When its hardcoded in, then it works. Any idea how to rewrite my "Measure 3" from above? You are probably correct that its the ALLSELECTED causing the issue. Basically I am using a slicer to choose an "AssetName" then I want it to sum the corresponding "Available MW" and pass it into my "Measure 4"