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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Deepanshu_46
Regular Visitor

Dynamic Title for field parameter

Hi,

I have created a field parameter :

image (1).png

 

I want to get a dynamic title for the visualization in which i am using this parameter with the condition that if user select more then 3 metric it the title should show etc ie those three metric and etc.I tried some approaches but getting error:
select metri 3 [select mertic 3] is part of composite key but not all columns of composite key is included in expression.Your help will be appriciated.

2 ACCEPTED SOLUTIONS
Ritaf1983
Super User
Super User

Hi @Deepanshu_46 
You can use DAX measure :

title =
VAR __SelectedValue =
    SELECTCOLUMNS (
        SUMMARIZE ( Parameter, Parameter[Parameter], Parameter[Parameter Fields] ),
        Parameter[Parameter]
    )
RETURN "ttitle  is ------"& CONCATENATEX ( __SelectedValue, Parameter[Parameter], ", " )
Note that this measure should be created in the parameters table
Ritaf1983_0-1697465728968.png

 

 

Link to the sample file 

 

Link for more information :
https://www.sqlbi.com/blog/marco/2022/06/11/using-selectedvalue-with-fields-parameters-in-power-bi/

 

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

 
Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

Anonymous
Not applicable

Hi  @Deepanshu_46 ,

 

Here are the steps you can follow:

1. Create calculated column.

Rank_column = RANKX('Table 2','Table 2'[Value1],,ASC)

vyangliumsft_0-1697684071726.png

2. Create measure.

Rank_measure =
RANKX(ALLSELECTED('Table 2'),CALCULATE(SUM('Table 2'[Rank_column])),,ASC)
Measure =
var _count=COUNTX(ALLSELECTED('Table 2'),'Table 2'[Value1])
var _Select=SELECTCOLUMNS('Table 2',"tag",'Table 2'[Value1])
var _title1=
    CONCATENATEX(
        FILTER(ALL('Table 2'),
        'Table 2'[Value1] in _Select),'Table 2'[Value1],"丶")
var _rank=
RANKX(
    FILTER(
        ALLSELECTED('Table 2'),'Table 2'[Value1] in _Select),CALCULATE(MAX('Table 2'[Value1])),,ASC)
var _title2=
    CONCATENATEX(
        FILTER(ALLSELECTED('Table 2'),
        [Rank_measure]<=3),'Table 2'[Value1],"丶")
return
IF(
    _count>3,
_title2&" "&"etc.",_title1)

 3. Visual -- Format –   TiTLE -- FX

vyangliumsft_1-1697684122121.png

vyangliumsft_2-1697684122124.png

4. Result:

 

vyangliumsft_4-1697684142374.png

 

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

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi  @Deepanshu_46 ,

 

Here are the steps you can follow:

1. Create calculated column.

Rank_column = RANKX('Table 2','Table 2'[Value1],,ASC)

vyangliumsft_0-1697684071726.png

2. Create measure.

Rank_measure =
RANKX(ALLSELECTED('Table 2'),CALCULATE(SUM('Table 2'[Rank_column])),,ASC)
Measure =
var _count=COUNTX(ALLSELECTED('Table 2'),'Table 2'[Value1])
var _Select=SELECTCOLUMNS('Table 2',"tag",'Table 2'[Value1])
var _title1=
    CONCATENATEX(
        FILTER(ALL('Table 2'),
        'Table 2'[Value1] in _Select),'Table 2'[Value1],"丶")
var _rank=
RANKX(
    FILTER(
        ALLSELECTED('Table 2'),'Table 2'[Value1] in _Select),CALCULATE(MAX('Table 2'[Value1])),,ASC)
var _title2=
    CONCATENATEX(
        FILTER(ALLSELECTED('Table 2'),
        [Rank_measure]<=3),'Table 2'[Value1],"丶")
return
IF(
    _count>3,
_title2&" "&"etc.",_title1)

 3. Visual -- Format –   TiTLE -- FX

vyangliumsft_1-1697684122121.png

vyangliumsft_2-1697684122124.png

4. Result:

 

vyangliumsft_4-1697684142374.png

 

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

Anonymous
Not applicable

It works. Thankyou so much for your kind help.

Anonymous
Not applicable

Hi @Ritaf1983 , thanks for your reply. I have many categories and I want I user select more then three category from the slicer , the title should show only three category name in the title along with etc for example if user select visit, bounce, spend and clicks, title should showe visit, bounce, spend etc.I hope it gives you more clarity on of my requirement. 

Ritaf1983
Super User
Super User

Hi @Deepanshu_46 
You can use DAX measure :

title =
VAR __SelectedValue =
    SELECTCOLUMNS (
        SUMMARIZE ( Parameter, Parameter[Parameter], Parameter[Parameter Fields] ),
        Parameter[Parameter]
    )
RETURN "ttitle  is ------"& CONCATENATEX ( __SelectedValue, Parameter[Parameter], ", " )
Note that this measure should be created in the parameters table
Ritaf1983_0-1697465728968.png

 

 

Link to the sample file 

 

Link for more information :
https://www.sqlbi.com/blog/marco/2022/06/11/using-selectedvalue-with-fields-parameters-in-power-bi/

 

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

 
Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

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.