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
AlixB
Frequent Visitor

Creating Dynamic Title for visual using calculated mesure

I'm trying to add a dynamic title to a visual, based on a selection of another visual, which I know how to do in theory, however the calculations to get it to work are causing a bit of a headache.

 

When a category in a table is clicked on, I want the title to show that category, however if no category is clicked I don't want the title to show all categories, but something like "All Categories"

 

My initial thought was to create a new measure with the calculation

Category = IF(DISTINCTCOUNT('Dataset1'[Account Category])>1,"All Categories",'Dataset1'[Account Category])
However this won't work because a measure doesn't allow me to use 'Dataset1'[Account Category] as the alternative outcome.
 
So I thought I'd create a measure and then a calculated column referencing the measure.
Category = IF(COUNT('Dataset1'[Account Category])>1,2,1)
TitleCategory = if('Dataset1'[Category]=2,"All Categories",'Dataser1'[Account Category])
However this doesn't work either as calculated columns can't reference a measure column with a count function.
 
So I'm stuck as to what to try next.
The logic is very simple but the system is not allowing the calculation.
Can anyone help please?

 

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@AlixB Check this out: https://community.powerbi.com/t5/Quick-Measures-Gallery/The-Most-Amazing-Mind-Blowing-Dynamic-Slicer....

 

In your first formula, use MAX around your column at the end.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @AlixB 

In addition to  's reply, we need to create a measure to get dynamic result.

Measure will return aggregations, in measure we need to use Sum function to get number type value and use Max function to get text, date type values.

Try this measure:

 

Measure = 
 IF(DISTINCTCOUNT('Dataset1'[Account Category])>1,"All Categories",MAX(Dataset1[Account Category]))

 

Result is as below. 

By default:

1.png

Select Category A in other visual:

2.png

You can refer to this blog to get more details about the differences between calculated column and measure.

 

Best Regards,
Rico Zhou

 

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

Greg_Deckler
Community Champion
Community Champion

@AlixB Check this out: https://community.powerbi.com/t5/Quick-Measures-Gallery/The-Most-Amazing-Mind-Blowing-Dynamic-Slicer....

 

In your first formula, use MAX around your column at the end.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler 

Thanks for that, it worked beautifully with a bit of tweaking.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

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

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.