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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Regular Visitor

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

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"

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

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors