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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Apar_FM
Frequent Visitor

Dynamic Chart title for column chart for TOP N selected in Filter page (count--number)

Dear Expert,

I am new in power bi

 

I have a column chart where I have selected the top 5 from the filter pane.

 

I want to have a dynamic chart title as below...

"Net Sales by State for Top" "XX" "State" (in place of XX I want --- count(number) of the selected item in filter pane)

My table name is "Sales" and my column name is "State"

 

 

Regards,

Tushar M.

1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @Apar_FM ,

 

Based on your description, I have created a simple sample:

vjianbolimsft_0-1673328662119.png

Please try to apply the measure to the title:

Measure = 
var _a = COUNT('Table'[ID])
return "Net Sales by State for Top "&_a&" State"

vjianbolimsft_1-1673328732251.png

Output:

vjianbolimsft_2-1673328757428.png

vjianbolimsft_3-1673328774750.png

 

Best Regards,

Jianbo Li

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

3 REPLIES 3
v-jianboli-msft
Community Support
Community Support

Hi @Apar_FM ,

 

Based on your description, I have created a simple sample:

vjianbolimsft_0-1673328662119.png

Please try to apply the measure to the title:

Measure = 
var _a = COUNT('Table'[ID])
return "Net Sales by State for Top "&_a&" State"

vjianbolimsft_1-1673328732251.png

Output:

vjianbolimsft_2-1673328757428.png

vjianbolimsft_3-1673328774750.png

 

Best Regards,

Jianbo Li

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

MAwwad
Solution Sage
Solution Sage

To create a dynamic chart title that displays the count of the top N states selected in the filter pane, you can use the following measure:

Chart Title = "Net Sales by State for Top " & RANKX(ALLSELECTED('Sales'[State]), 'Sales'[Net Sales],, ASC, DENSE) & " States"

This measure uses the RANKX function to determine the rank of each state based on its net sales, and then displays the rank as the chart title. The ALLSELECTED function is used to ensure that the ranking is based on all of the states currently selected in the filter pane.

Hi DataSlyer,

It is not working. Maybe I am not able to understand my query better so I am rewriting it with a chart example..

Below is my chart where I already have the best 5 from the filter pane.

Now i dont understand is that how RankX will help me. I belive its may be count formula which is to be used.

 

Now from below if i choose 5 then it shows in title as 5 if top 7 then 7....

 

Apar_FM_2-1673238996743.png

 

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors