Forum Discussion
Dynamic chart title based on field parameter lakehouse
Hello,
this is my field parameter created in onelake model :
and they are working in report:
this is connected to chart and legend is reacting for it.
But how to write measure to have dynamic title for chart?
I tried with:
Chart Title =
VAR sel =
SELECTEDVALUE ( 'Subscription Hierarchy All Switcher'[Subscription Hierarchy All Switcher] )
RETURN
"Top 5 Total Amortized Cost by " &
COALESCE ( sel, "SubscriptionName" )
But didnt work.
Any ideas?
Best,
Jacek
Hi jaryszek
You cannot directly reference in a measure the field name column of a field parameter table but the other two columns. Try this:
Chart Title = "Top 5 Total Amortized Cost by " & SWITCH ( SELECTEDVALUE ( Fct_EA_AmortizedCosts[Order] ), 1, "SubscriptionName", 2, "NormalizedResourceGroup", 3, "NormalizedResourceName" )
4 Replies
- wardy912Super User
Hi jaryszek
You shouldn't need to edit anything or add a measure, just enable the title on your chart visual and leave as default. If you've already changed the title, recreate the visual. If you need to change the title, edit the name of the field you've added to the chart (Highlighted in my image, as the original measure was called 'ProductCount' so I added a space).
Here I have a field parameter that chooses either Region or Category. You'll see when I select an option in the slicer, the title changes.
--------------------------------
I hope this helps, please give kudos and mark as solved if it does!
Connect with me on LinkedIn.
Subscribe to my YouTube channel for Fabric/Power Platform related content!
- jaryszekSuper User
thank you it worked!
- danextianSuper User
Hi jaryszek
You cannot directly reference in a measure the field name column of a field parameter table but the other two columns. Try this:
Chart Title = "Top 5 Total Amortized Cost by " & SWITCH ( SELECTEDVALUE ( Fct_EA_AmortizedCosts[Order] ), 1, "SubscriptionName", 2, "NormalizedResourceGroup", 3, "NormalizedResourceName" )- jaryszekSuper User
thank you,
i tried with:Chart Title Subscription Hierarchy = "Top 5 Total Amortized Cost by " & SWITCH ( SELECTEDVALUE ( 'Subscription Hierarchy All Switcher'[Subscription Hierarchy All Switcher Order] ), 0, "SubscriptionName", 1, "NormalizedResourceGroup", 2, "NormalizedResourceName" )I tried to refer to Order column of parameter field table...
(first I have changed [Subscription Hierarchy All Switcher Order] columne to be integer).
And it worked but but you need to remember to start from 0, not 1...
edit:
updated option:VAR sel = SELECTEDVALUE ( 'Subscription Hierarchy All Switcher'[Subscription Hierarchy All Switcher Order], -1 -- when blank or multiple ) RETURN "Top 5 Total Amortized Cost by " & SWITCH ( sel, 0, "SubscriptionName", 1, "NormalizedResourceGroup", 2, "NormalizedResourceName", "SubscriptionName" -- default text )
Thank you!
Jacek