Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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" ) )
Evidently no-one knows how to do this! I'll try to figure it out.
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 💡
Proud to be a Super User! | |
A calculated column cannot be used as a data label it needs to be a measure.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 39 | |
| 37 | |
| 35 | |
| 34 | |
| 27 |
| User | Count |
|---|---|
| 137 | |
| 97 | |
| 74 | |
| 66 | |
| 65 |