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
Super User
5 years agoHi EmmaWyeth ,
Almost certainly not a Power BI version thing, unless you're on the October 1982 release.
Very difficult to diagnose exactly what the issue is without seeing your actual data/model/calculations etc., but I believe your required measure should look *something* like this, assuming that your slicer selects 'Date'[Week]:
Measure =
VAR selectedAmount =
CALCULATE(
[amount],
'Date'[Week] = SELECTEDVALUE('Date'[Week])
)
VAR averageAmount =
CALCULATE(
[amount],
'Date'[Last 12 Weeks] = "Yes"
) / 12
RETURN
if(
selectedAmount > averageAmount,
"yes",
"no"
)
Pete
EmmaWyeth
5 years agoFrequent Visitor
It is telling me that SELECTEDVALUE is not a valid function name. Any ideas?