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
the606
Helper I
Helper I

Conditional formatting on multiple columns

Hi,

 

Im trying to add a column to contain one of three numbers (1,2,3) to use for conditonal formatting.

 

I have several Risk columns in which can be either "please update, High, Medium, Low"

 

If one of the columns contains a high then it needs to be a 1 regardless of the others.

 

I have managed to use a conditional column for one but i cant seem to get the syntax correct to look at multiple columns 

 

= Table.AddColumn(#"Filtered Rows", "Custom", each if [RISK_LEVEL] = "High" then 1 else if [RISK_LEVEL] = "Medium" then 2 else if [RISK_LEVEL] = "Low" then 3 else null)

 

Any help would be much appreciated as i am sure im just missing somethign very simple.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@the606 , I typically use a measure approach. I create a measure and use that in conditional formatting using "Field Value" option

 

color =
switch ( true(),
FIRSTNONBLANK('Table'[commodity],"NA") ="commodity1" && sum('Table'[Value]) >500,"lightgreen",
FIRSTNONBLANK('Table'[commodity],"NA") ="commodity2" && sum('Table'[Value]) >1000,"lightgreen",
// Add more conditions
"red"
)

 

https://radacad.com/dax-and-conditional-formatting-better-together-find-the-biggest-and-smallest-num...
https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values

View solution in original post

3 REPLIES 3
Greg_Deckler
Super User
Super User

@the606 You probably want to create a "flag" measure that returns, for example 1 or 0 depending on what color you want to set. So, something like:

Flag Measure =
  VAR __Calc = <some calculation>
RETURN
  IF(__Calc > <something>,1,0)

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
amitchandak
Super User
Super User

@the606 , I typically use a measure approach. I create a measure and use that in conditional formatting using "Field Value" option

 

color =
switch ( true(),
FIRSTNONBLANK('Table'[commodity],"NA") ="commodity1" && sum('Table'[Value]) >500,"lightgreen",
FIRSTNONBLANK('Table'[commodity],"NA") ="commodity2" && sum('Table'[Value]) >1000,"lightgreen",
// Add more conditions
"red"
)

 

https://radacad.com/dax-and-conditional-formatting-better-together-find-the-biggest-and-smallest-num...
https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values

great thanks ill give that a go.

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.

Top Solution Authors