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
JemmaD
Helper V
Helper V

Creating custom text data labels for chart

I have a stacked column chart which holds two categories: Focus and Strategic. The values in the stacked are basicaly Yes and No for these two options. 

I am trying to create a custom data label which shows 'Focus' or 'Non-Focus' for the yes and no of this category, and 'Strategic' and 'Non-Strategic' for the yes and no of this category. Because simply Yes and No sounds silly and is not informative.

So there are four options for the data label basically.

 

I am using a nest if statement inside a switch statement to create the data labels, but i'm getting an error that it's trying to create a true/false result when I need a text result. 

 

Below is my syntax, if someone could help me get it working that would be super:

Data Label = 
SWITCH (
IF ( SELECTEDVALUE ( 'Broker Type'[Broker Type] , "Focus" ) && SELECTEDVALUE ( 'Broker Type'[Count] , "Y" ) , "Focus" ) ,
IF ( SELECTEDVALUE ( 'Broker Type'[Broker Type] , "Focus" ) && SELECTEDVALUE ( 'Broker Type'[Count] , "N" ) , "Non-Focus" ) ,
IF ( SELECTEDVALUE ( 'Broker Type'[Broker Type] , "Strategic" ) && SELECTEDVALUE ( 'Broker Type'[Count] , "Y" ) , "Strategic" ) ,
IF ( SELECTEDVALUE ( 'Broker Type'[Broker Type] , "Strategic" ) && SELECTEDVALUE ( 'Broker Type'[Count] , "N" ) , "Non-Strategic" ) )
3 REPLIES 3
JemmaD
Helper V
Helper V

Evidently no-one knows how to do this! I'll try to figure it out.

Idrissshatila
Super User
Super User

Hello @JemmaD ,

 

can you try creating it as a calculated column with the following formula

Data Label = 
SWITCH (
IF (  'Broker Type'[Broker Type] = "Focus"  &&   'Broker Type'[Count] = "Y"  , "Focus"  ,
IF (  'Broker Type'[Broker Type] = "Focus"  &&  'Broker Type'[Count] = "N"  , "Non-Focus"  ,
IF (  'Broker Type'[Broker Type] = "Strategic"  && 'Broker Type'[Count] = "Y"  , "Strategic"  ,
IF (  'Broker Type'[Broker Type] = "Strategic"  &&  'Broker Type'[Count] = "N"  , "Non-Strategic" ) )))

 

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

Follow me on Linkedin
Vote for my Community Mobile App Idea 💡



Did I answer your question? Mark my post as a solution! Appreciate your Kudos
Follow me on LinkedIn linkedIn
Vote for my Community Mobile App Idea

Proud to be a Super User!




A calculated column cannot be used as a data label it needs to be a measure.

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.