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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
eomedes
Advocate I
Advocate I

How to apply Conditional Formatting to a column in a matrix based on "VENTA" per month

Hi,

I have a matrix in Power BI with the following columns:

eomedes_0-1742376714637.png

 

  • A blank column (where I want to apply conditional formatting).
  • "VENTA" (sales value per month).
  • "% of total" (which I don’t want to use for conditional formatting).
  • "%Var" (also not relevant for the formatting).

My goal is to color the background of the blank column based on the "VENTA" value, but considering each month individually (not in relation to the total of the matrix).

The problem is that when I try to apply conditional formatting, Power BI tends to reference the total instead of evaluating each month separately.

How can I make the conditional formatting of the blank column based only on "VENTA" and specific to each month in the matrix?

Thanks in advance!


6 REPLIES 6
v-tsaipranay
Community Support
Community Support

Hi @eomedes ,

 

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

 

Thank you.

v-tsaipranay
Community Support
Community Support

Hi @eomedes ,

 

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

 

Thank you.

 

v-tsaipranay
Community Support
Community Support

Hi @eomedes 

Thank you for reaching out to the Microsoft fabric community forum. 


I wanted to check if you had the opportunity to review the information provided by @Khushidesai0109 . Please feel free to contact us if you have any further questions. If the response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.


Thank you.

Khushidesai0109
Continued Contributor
Continued Contributor

Hiii @eomedes 

 

Create a measure to normalize "VENTA" per month

Sales_Per_Month =
VAR CurrentMonth = SELECTEDVALUE(YourDateTable[Month])
RETURN
CALCULATE(SUM(SalesTable[VENTA]), ALLEXCEPT(SalesTable, YourDateTable[Month]))


Create a measure for conditional formatting
Sales_Formatting = 
VAR MaxVenta = MAXX(ALLSELECTED(SalesTable), SalesTable[VENTA])
VAR MinVenta = MINX(ALLSELECTED(SalesTable), SalesTable[VENTA])
VAR CurrentVenta = SUM(SalesTable[VENTA])
RETURN
IF(
CurrentVenta >= MaxVenta * 0.8, 1, // High sales (80% or more of max)
IF(CurrentVenta <= MinVenta * 1.2, -1, // Low sales (close to min)
0) // Neutral
)

  1. Apply the measure to the blank column:
    • Go to Conditional Formatting → Background Color.
    • Choose Rules or Field Value.
    • Select Sales_Formatting as the field.
    • Assign colors:
      • 1 (High Sales) → Green
      • 0 (Neutral) → Yellow
      • -1 (Low Sales) → Red
Now, each month's sales will have its own conditional formatting based on "VENTA" independently.


If this helps, I would appreciate your KUDOS!
Did I answer your question? Mark my post as a solution!
 



Thank you very much for your help!

However, I need it to be in a gradient. If that's not possible, I would like to have more than 5 color ranges to create a semi-gradient effect.

This measure scales "VENTA" values from 0 to 1, ensuring each month is evaluated independently.

Venta_Normalized =
VAR CurrentVenta = SUM(SalesTable[VENTA])
VAR MinVenta = CALCULATE(MIN(SalesTable[VENTA]), ALLEXCEPT(SalesTable, YourDateTable[Month]))
VAR MaxVenta = CALCULATE(MAX(SalesTable[VENTA]), ALLEXCEPT(SalesTable, YourDateTable[Month]))

RETURN
IF(
MaxVenta = MinVenta,
0.5, // To avoid division by zero, set mid-scale if all values are the same
(CurrentVenta - MinVenta) / (MaxVenta - MinVenta)
)

pply the Measure for Gradient Formatting

  1. Go to the blank column where you want the formatting.
  2. Click on Conditional Formatting → Background Color.
  3. Select "Field Value" and choose Venta_Normalized.
  4. Set a gradient color scale, for example:
    • 0 (lowest sales) → Red
    • 0.5 (mid sales) → Yellow
    • 1 (highest sales) → Green

 

If this helps, I would appreciate your KUDOS!
Did I answer your question? Mark my post as a solution!

 

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.