Forum Discussion
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
- IdrissshatilaSuper 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 💡- JemmaDHelper V
A calculated column cannot be used as a data label it needs to be a measure.
- JemmaDHelper V
Evidently no-one knows how to do this! I'll try to figure it out.