Forum Discussion
EmmaWyeth
5 years agoFrequent Visitor
Measure based on Slicer Selection
Hi All I am trying to write a calculation measure in Power BI, to work out if this week's volumes are greater or less than the average of the last 12 weeks volumes. If greater then "yes" otherwi...
BA_Pete
5 years agoSuper User
Ok. I guess you are using Direct Query mode rather than import?
Try this instead. I'm working on the assumption that your slicer is set to single-select on 'Date'[Week]:
Measure =
VAR selectedAmount =
[amount]
VAR averageAmount =
CALCULATE(
[amount],
'Date'[Last 12 Weeks] = "Yes"
) / 12
RETURN
if(
selectedAmount > averageAmount,
"yes",
"no"
)
Pete
EmmaWyeth
5 years agoFrequent Visitor
Sorry for the delay, got called away on other reports.
Just tried this new bit of code, but am getting a syntax error. It reads exactly the same as yours above, any ideas?