Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

Dynamic display names of parameter fields

I created a parameter field to show On Y-axes of a graph:


Y-Axis = {
    ("Gross", NAMEOF('FCT_Actual'[_REF Actual - Quantity]), 0),
    ("Budget", NAMEOF('FCT_Budget'[Budget]), 1)
The measure _REF Actual - Quantity is showing one measure based on a slicer (Gross, Nett)
_REF Actual - Quantity =
 IF (
     HASONEVALUE(Switch_Gross_Nett[Gross Nett]),
         VALUES(Switch_Gross_Nett[Gross Nett]),
         "Gross", [_REF Gross Quantity],
         "Nett", [_REF Nett Quantity]
The measure works fine
But now If I add the parameter field into graph its showing "Gross"  as display name even when Nett is selected
So I thought let add some code to the parameter field to make the name dynamic
I only changed the first part
(if(SELECTEDVALUE(Switch_Gross_Nett[Gross Nett])="Gross","Gross","Nett")", NAMEOF('FCT_Actual'[_REF Actual - Quantity]), 0),
But its not working. I know an "If-statemnet" works so probably the selectedvalue does not work.
Any one any idea how to solve this?
Super User
Super User

@rjobaan , I used code to show selected value in this blog


What is selected = maxx(filter(‘Axis Slicer’, ‘Axis Slicer’[Axis Slicer Order]= SELECTEDVALUE(‘Axis Slicer’[Axis Slicer Order])),’Axis Slicer’[Axis Slicer])

I tried that, but it does not work


i changed (if(SELECTEDVALUE(Switch_Gross_Nett[Gross Nett])="Gross","Gross","Nett")", NAMEOF('FCT_Actual'[_REF Actual - Quantity]), 0),


 (if(maxx(filter(Switch_Gross_Nett, Switch_Gross_Nett[Gross Nett]= SELECTEDVALUE(Switch_Gross_Nett[Gross Nett])),Switch_Gross_Nett[Gross Nett])="Gross","Gross","Nett"), NAMEOF('FCT_Actual'[_REF Actual - Quantity], 0)
it keeps showing "Nett" even if I change to "Gross"

Hi @rjobaan,

Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  


Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors
Top Kudoed Authors