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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
utkarshshastri
Frequent Visitor

unable to add conditional formatting on a measure which returns text output

pbipbi

the above account stage column is a measure and I am trying to add consitional formatting using measure , and New color code is created suing below DAX query 

 
 
New color code =
VAR colorcode =SELECTEDVALUE('color code'[Account stage])
RETURN

SWITCH(TRUE(),
colorcode ="High Awareness",1,
colorcode ="Medium Awareness",2,
colorcode ="Low Awareness",3,
colorcode ="High conversion",4,
colorcode ="Medium conversion",5,
colorcode ="Low conversion",6,
colorcode ="High Engagement",7,
colorcode ="Medium Engagement",8,
colorcode ="Low Engagement",9
)
 
I am not sure what is wrong I am not able to get values in column or able to conditonally format the account stage column
 
thanks in advance 
1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @utkarshshastri ,

 

If the value you are using for the condittional formatting is a measure you must use the measure itself and not the SELECTEDVALUE try the following:

New color code =
SWITCH([Account stage],
"High Awareness",1,
"Medium Awareness",2,
"Low Awareness",3,
"High conversion",4,
"Medium conversion",5,
"Low conversion",6,
"High Engagement",7,
"Medium Engagement",8,
"Low Engagement",9
)

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

2 REPLIES 2
utkarshshastri
Frequent Visitor

thanks @MFelix  it worked like a charm

MFelix
Super User
Super User

Hi @utkarshshastri ,

 

If the value you are using for the condittional formatting is a measure you must use the measure itself and not the SELECTEDVALUE try the following:

New color code =
SWITCH([Account stage],
"High Awareness",1,
"Medium Awareness",2,
"Low Awareness",3,
"High conversion",4,
"Medium conversion",5,
"Low conversion",6,
"High Engagement",7,
"Medium Engagement",8,
"Low Engagement",9
)

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Top Solution Authors