Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
rjobaan
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]),
     SWITCH(
         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?
 
4 REPLIES 4
oduc78
Advocate I
Advocate I

Hello, I've got a similar issue but I haven't been able to find a solution. I created a new post: SELECTEDVALUE doesn't work to add a dynamic header to Field Parameters. Maybe comparing similar problems can help us solve them, let me know.

Olivier.

amitchandak
Super User
Super User

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

https://amitchandak.medium.com/power-bi-field-parameters-a-quick-way-for-dynamic-visuals-fc4095ae9af...

 

What is selected = maxx(filter(‘Axis Slicer’, ‘Axis Slicer’[Axis Slicer Order]= SELECTEDVALUE(‘Axis Slicer’[Axis Slicer Order])),’Axis Slicer’[Axis Slicer])
Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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),

into

 (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"
Anonymous
Not applicable

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  

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.