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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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

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
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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