Skip to main content

Power BI

Needs Votes

On visuals, adapt the name of measure according to a slicer selection

Vote (5) Share
Elisa Terzo's profile image

Elisa Terzo on 10 Aug 2020 14:33:50

Example: have a measure that executes different calculation according to a slicer selection.
Actual behavior: using the measure on visual, the name is static.
Desired behavior: change the name shown in visuals according to the slicer selection. For example: like titles or concatenating the selected value at the end of measure name.

Comments (3)
Elisa Terzo's profile image Profile Picture

Elisa Terzo on 23 Nov 2020 11:01:49

RE: On visuals, adapt the name of measure according to a slicer selection

Sorry, Todd, I read better your comment. Thanks for your suggestions

Elisa Terzo's profile image Profile Picture

Elisa Terzo on 23 Nov 2020 10:55:05

RE: On visuals, adapt the name of measure according to a slicer selection

@Todd Chittenden The scenario described is different from my idea.
With your measure, you can switch the values but not the name on the column. I ask for a way to change the columns' names according to a DAX formula for measures like your example.

Elisa Terzo's profile image Profile Picture

Todd Chittenden on 10 Aug 2020 19:57:18

RE: On visuals, adapt the name of measure according to a slicer selection

This is pretty much already available using the SELECTEDVALUE() DAX function.
Do this: Create a table (MyTable) with columns ID (Integer) and Name (text). Enter values:
1 / SUM of some Measure
2 / AVG of the Measure

Create two measures that would return each of the above calculations.

Create a Measure with the following formula:
My Measure = SWITCH(
SELECTEDVALUE ( 'MyTable'[ID]),
1, [Sum of some Measure],
2, [AVG of the Measure]
)

Add this third measure to a chart of table. On the same page, add a Slicer for MyTable. When you select one value of another, the SWITCH statement looks at the SELECTEDVALUE of that table/slicer, and returns the appropriate Measure.