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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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