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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
joannasokolowsk
Helper II
Helper II

Color conditional formatting based on column

Hi all,

I would like to ask you about conditional formatting regarding table chart. Is there a way to add a background color for values from FY19 column if the value is smaller/bigger comparing to value in FY18 column. 

 

joannasokolowsk_0-1613735141440.png

 

Thanks,

Asia

 

 

3 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@joannasokolowsk , have year measures like

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))

diff = [This Year]-[Last Year ]

 

If date is selected

 

Create a color measure and use that is conditional formatting using field value option

if([diff] > 0, "green", "red")

 

refer for steps

 

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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

negi007
Community Champion
Community Champion

@joannasokolowsk 

Please follow below steps

 

1. Create a measure to calculate difference between two financial years. 

FY_Diff = SUM(FY_Compar[FY19])-SUM(FY_Compar[FY18])
(imp: if you do not have FY19 and FY18 as seperate columns, then you will have to create two more measures. each one to calcualte financial year values of FY18 and FY19 )
 
2. Then use the measure created in first step for conditionalf formatting like below
 
 
negi007_1-1613737576141.png

 

3. Your final output is below

negi007_2-1613737606285.png

 

let me know if you need more assistance in this. I hope this should resolve your concern.

 




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



Proud to be a Super User!


Follow me on linkedin

View solution in original post

Hi, @joannasokolowsk 

Yes,the conditional format is based on some field. If you have 20 sets of such comparisons, then it is inevitable that you need 20 such  fields (column\measure) as the basis for judgment.

 

Best Regards,
Community Support Team _ Eason

View solution in original post

5 REPLIES 5
joannasokolowsk
Helper II
Helper II

Thank you!

joannasokolowsk
Helper II
Helper II

Thanks for your suggestions! If I need to compare 20 such columns I guess I need to create a mesaure for all such cases, right? 

 

Thanks,

Asia

Hi, @joannasokolowsk 

Yes,the conditional format is based on some field. If you have 20 sets of such comparisons, then it is inevitable that you need 20 such  fields (column\measure) as the basis for judgment.

 

Best Regards,
Community Support Team _ Eason

negi007
Community Champion
Community Champion

@joannasokolowsk 

Please follow below steps

 

1. Create a measure to calculate difference between two financial years. 

FY_Diff = SUM(FY_Compar[FY19])-SUM(FY_Compar[FY18])
(imp: if you do not have FY19 and FY18 as seperate columns, then you will have to create two more measures. each one to calcualte financial year values of FY18 and FY19 )
 
2. Then use the measure created in first step for conditionalf formatting like below
 
 
negi007_1-1613737576141.png

 

3. Your final output is below

negi007_2-1613737606285.png

 

let me know if you need more assistance in this. I hope this should resolve your concern.

 




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



Proud to be a Super User!


Follow me on linkedin

amitchandak
Super User
Super User

@joannasokolowsk , have year measures like

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))

diff = [This Year]-[Last Year ]

 

If date is selected

 

Create a color measure and use that is conditional formatting using field value option

if([diff] > 0, "green", "red")

 

refer for steps

 

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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.