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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
lennardheyder
Frequent Visitor

PowerBi table | Conditional formatting per line

Dear forum,

We are trying to visualize the change in margins per kg or prices per month by product group with a color gradients (red/yellow/green). The columns should show month.year, the lines the product groups and the average selling price as value. In Excel it is rather straight forward (individual conditional formatting per line available). In PowerBi it is more challenging as there is only conditional formatting for the total table available:

Excel:

Gradient.png

 

 

 

 

 

 PowerBi:

lennardheyder_1-1678706743911.jpeg

Any idea how to implement ? The following website gave a good hint but not sufficient for the challenge:

Power BI Conditional Formatting by Rows | by Patrick Pichler | Creative Data | Medium

 

5 REPLIES 5
lennardheyder
Frequent Visitor

Hey @Padycosmos , this is not really helpful I believe....we would need to calculate an %-value for each line based on the min / max and base a measure on this value (similiar to the linked article but for lines, not for rows)

 

https://medium.com/creative-data/power-bi-conditional-formatting-by-rows-8ce6187e25c6

Would you be able to share the pbix file?

 Feb 2022Mar 2022Apr 2022May 2022Jun 2022Jul 2022
Product 11,201,601,151,181,300,90
Product 29116678
Product 3213027192522
Product 42,32,82,92,144,1

 

Attached a dataset, we would need to have gradient color per line, so would mean for Product 4 - 4,1 dark green,   2,1 red 

Hope this helps:

Colour =
SWITCH(TRUE(),SELECTEDVALUE(Data[Product])="Product 4" && SELECTEDVALUE(Data[Amount])>=4,"Dark Green",
SELECTEDVALUE(Data[Product])="Product 4" &&( SELECTEDVALUE(Data[Amount])>=2.5 && SELECTEDVALUE(Data[Amount])<4),"Yellow",SELECTEDVALUE(Data[Product])="Product 4" &&( SELECTEDVALUE(Data[Amount])>=MIN(Data[Amount]) && SELECTEDVALUE(Data[Amount])<2.5),"Red")
For this to work, all your dates should be in one column and amount should be in a separate column in the table. If it is not so, in the table, you may have to unpivot the month-year columns.
If you are unfamiliar with unpivoting, you may watch this screen-recording
 

Padycosmos_0-1678716865397.png

 

Padycosmos
Solution Sage
Solution Sage

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.