Forum Discussion
Error When Referencing Field Parameter in a Measure
I have a measure that dynamically returns a chart title based on slicer selection.
Now I want to add to the measure a field parameter that will determine the chart title based on the slicer selections AND the field parameter selection. However, I get an error when trying to do so.
Is it even possible to implement what I'm trying to achieve? Appreciate any tips please bhanu_gautam lbendlin š
Note: the field parameter is referencing measures only and for each of the measures referenced, they too are referencing other measures. Hope that makes sense.
Dynamic Chart Title =
VAR FieldParameter = SELECTEDVALUE('Ethnicity Filter'[Ethnicity Filter])
VAR Slicer1 = SELECTEDVALUE('Gender and Ethnic Pay'[Business Unit 1])
VAR Slicer2 = SELECTEDVALUE('Gender and Ethnic Pay'[Business Unit 2])
VAR ChartTitle =
IF(
ISBLANK(FieldParameter),
"ALL ETHNICITIES",
FieldParameter & " REPRESENTATION"
)
RETURN
SWITCH(
TRUE(),
ISBLANK(Slicer1) && ISBLANK(Slicer2), "MPI - " & ChartTitle & " by TENURE",
NOT ISBLANK(Slicer1) && ISBLANK(Slicer2), UPPER(Slicer1) & " - " & ChartTitle & " by TENURE",
NOT ISBLANK(Slicer1) && NOT ISBLANK(Slicer2), UPPER(Slicer2) & " - " & ChartTitle & " by TENURE"
)
//Field Parameter
Ethnicity Filter = {
("European", NAMEOF('Measures - General'[European Rate]), 0),
("Other Ethnicity", NAMEOF('Measures - General'[Other Rate]), 1),
("Asian", NAMEOF('Measures - General'[Asian Rate]), 2),
("MÄori", NAMEOF('Measures - General'[MÄori Rate]), 3),
("Pacific Peoples", NAMEOF('Measures - General'[Pacific Rate]), 4),
("MELAA", NAMEOF('Measures - General'[MELAA Rate]), 5)
}
2 Replies
- AnonymousNot applicable
Hi Anonymous,
Could you please share a pbix or some sample data that maintains the original data structure and expected results? This will help us clarify your situation and test the coding formulas.
Best regards,Joyce
- lbendlinSuper User
the field parameter is referencing measures only and for each of the measures referenced, they too are referencing other measures. Hope that makes sense.During troubleshooting you will want to keep it simple. Recommendation is to expand all measures and avoid nesting.