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
itchyeyeballs
Impactful Individual
Impactful Individual

Field Parameters - Dynamic Visual Title

Hi All,

 

Started exploring the new field parameters which IMO is potentially the biggest upgrade to PowerBI ever. Report design can now be much more streamlined and easy to maintain.

So far I have managed to get the functionality working and have also found that you can create "chained" measures that let you dynamically change multiple elements at the same time

For example:

 

xP_param1 = 
SWITCH (
    SELECTEDVALUE ( xP_Param[xP_Param Order] ),
    0, [Measure1],
    1, [Measure2],
    2, [Measure3],
    3, [Measure4],
    4, [Measure5]
)

 


This lets me have a custom measure for each different parameter option so I can change axis, legend and value (measure) at the same time. Use case is where a slightly different calculation is needed for each option.

What I can't work out is how to make another measure to use as a dynamic visual/page title (I must be missing something obvious)

If I use 

 

xP_Param_Title = SELECTEDVALUE ( xP_Param[xP_Param] )

 


I get an error:
Calculation error in measure 'xP_Param'[xP_Param_Title]: Column [xP_Param] is part of composite key, but not all columns of the composite key are included in the expression or its dependent expression.

Any ideas how to solve?

1 ACCEPTED SOLUTION
itchyeyeballs
Impactful Individual
Impactful Individual

Thank you,

 

My setup seems to be a bit different.

When I use the field parameter wizard it creates a calculated table with 3 columns:

xP_Param
xP_Param Fields
xP_Param Order

I can use the Fields or Order columns but get the composite key error if trying to use the XP_Parm column which has the formated text name I want to use as the visual title.

I tried adding .Key0 as in the link you provided but encountered a different error.

Is there something I'm missing?

Edit, I found a work around using my switch syntax but its a bit of extra work to retype the titles and not re-use them from the calculated table column

 

xP_param1 Title = 
SWITCH (
    SELECTEDVALUE ( xP_Param[xP_Param Order] ),
    0, "Title 1",
    1, "Title 2",
    2, "Title 3",
    3, "Title 4",
    4, "Title 5"
)

 

Second edit, SQLBI just posted a great article describing this issue and how to solve it - https://www.sqlbi.com/blog/marco/2022/06/11/using-selectedvalue-with-fields-parameters-in-power-bi/

 

View solution in original post

4 REPLIES 4
itchyeyeballs
Impactful Individual
Impactful Individual

Thank you,

 

My setup seems to be a bit different.

When I use the field parameter wizard it creates a calculated table with 3 columns:

xP_Param
xP_Param Fields
xP_Param Order

I can use the Fields or Order columns but get the composite key error if trying to use the XP_Parm column which has the formated text name I want to use as the visual title.

I tried adding .Key0 as in the link you provided but encountered a different error.

Is there something I'm missing?

Edit, I found a work around using my switch syntax but its a bit of extra work to retype the titles and not re-use them from the calculated table column

 

xP_param1 Title = 
SWITCH (
    SELECTEDVALUE ( xP_Param[xP_Param Order] ),
    0, "Title 1",
    1, "Title 2",
    2, "Title 3",
    3, "Title 4",
    4, "Title 5"
)

 

Second edit, SQLBI just posted a great article describing this issue and how to solve it - https://www.sqlbi.com/blog/marco/2022/06/11/using-selectedvalue-with-fields-parameters-in-power-bi/

 

Thank you @itchyeyeballs  It works for me.

v-yangliu-msft
Community Support
Community Support

Hi  @itchyeyeballs ,

For this error, you can refer to the following link:

https://social.msdn.microsoft.com/Forums/en-US/d8524c95-5613-4f9b-9e54-0c7d264a27d5/dax-dimension-co...

 

For the title, you can turn it into Text format:

xP_Param_Title =
var _select=SELECTEDVALUE ( xP_Param[xP_Param Order] )
return
SWITCH (
    TRUE()
    ,
  _select=  0, [MeasureA],
  _select=  1, [MeasureB],
   _select= 2, [MeasureC]
)
Flag =
FORMAT('xP_Param'[xP_Param_Title],"0")

Format – Title – Title text – fx.

vyangliumsft_0-1653308359491.png

Enter the Title text – Title interface. Select [Flag].

vyangliumsft_1-1653308359494.png

vyangliumsft_2-1653308359496.png

Result:

vyangliumsft_3-1653308359497.png

If you need pbix, please click here.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Thats a good solution. But how can i get rid of the hometable name of the title. In your case xP_Param. 
How the measure code would be looking?

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.