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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
sreepathy1104
New Member

Background color for entire table based on value

How to do conditional formatting to change background color for power bi table based on values.

 

So, we can do the conditional formatting for each column. But my table contains around 15 columns so instead of doing it manually I'm looking for a efficient way. The criteria is if my value is <= 20, then background color should be red.

2 REPLIES 2
olgad
Super User
Super User

Hi @sreepathy1104 , just wanted to follow up if the solution provided worked?


DID I ANSWER YOUR QUESTION? PLEASE MARK MY POST AS A SOLUTION! APPRECIATE YOUR KUDO/LIKE!
PROUD TO BE A SUPER USER!
Best Stories, Interesting Cases: PowerBI Storytime Newsletter
Linkedin Profile: Linkedin
YouTube Channel: PowerBI Storytime
olgad
Super User
Super User

Hi, if you create a table with 2 columns , 1 would have the names of your 15 columns, the other would have the index. 
name index
Sales 1
Costs 2
%Growth 3 etc
Then create only one measure
Switch(max(index),
1, Sum(Sales), 
2, Sum(Costs),
3, Divide(Sum(Sales)-Sum(Costs), Sum(Costs))
Since you already have those 15 calculated, you can just plug in those measures instead of calculations. 

Switch(max(index),
1, Total Sales, 
2, Total Costs,
3, %Growth)

Place the 
names onto the columns, this one measure onto the values and then you have just this one measure to apply conditional formatting to. 

 

if needed different formats % and absolute, then work with the word FORMAT


DID I ANSWER YOUR QUESTION? PLEASE MARK MY POST AS A SOLUTION! APPRECIATE YOUR KUDO/LIKE!
PROUD TO BE A SUPER USER!
Best Stories, Interesting Cases: PowerBI Storytime Newsletter
Linkedin Profile: Linkedin
YouTube Channel: PowerBI Storytime

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.