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

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

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
October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.