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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

DAX Function

sk2024_0-1725599622621.png

Example to undersatnd the data:-
60 is the total Model Allocated capacity of Models 855 and N14 both under S/N 1. Similarly 72 is Model Allocated capacity of Models QSM15 under S/N 2. 

Question:-
Total demand on 24-09-02 for S/N is 47 but total allocated capacity is 60. So, demand is less than capacity. 
If total demand is less than allocated capacity then output should be 0, if it is greater than allocated capacity then output should be 1. Ignore Backlog in it. 
I want to use conditional formatting "Background color" in Matrix visual. So, I will denote 0 as red, 1 as green in background color.

Please help me in it.

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous ,
Does the information provided by suparnababu8  help you solve your problem? If it helps, please accept the responses you find helpful as solution.

Best regards,
Albert He

suparnababu8
Super User
Super User

Hi @Anonymous 

To achieve the desired conditional formatting in Power BI, you can create a measure that checks whether the total demand is less than or greater than the allocated capacity and then apply conditional formatting based on this measure. Here’s how you can do it:

Step-by-Step Instructions

  1. Create a Measure to Compare Demand and Capacity:

 

DemandVsCapacity = 
IF(
    SUM('YourTable'[TotalDemand]) <= SUM('YourTable'[AllocatedCapacity]),
    0,
    1
)

 

      • Add the DemandVsCapacity measure to your matrix visual.
    1. Apply Conditional Formatting:

      • Select the matrix visual.
      • Go to the Format pane.
      • Expand the Conditional formatting section.
      • Select Background color.
      • Choose the DemandVsCapacity measure.
      • Set the rules for the background color:
        • If the value is 0, set the background color to red.
        • If the value is 1, set the background color to green.

    Example DAX Measure 

 

DemandVsCapacity = 
IF(
    SUM('YourTable'[TotalDemand]) <= SUM('YourTable'[AllocatedCapacity]),
    0,
    1
)

 

Applying Conditional Formatting

  1. Select the Matrix Visual:

    • Click on your matrix visual to select it.
  2. Open the Format Pane:

    • Go to the Format pane on the right side of the screen.
  3. Conditional Formatting:

    • Expand the Conditional formatting section.
    • Click on Background color.
    • Choose the DemandVsCapacity measure.
    • Set the rules:
      • For value 0, set the background color to red.
      • For value 1, set the background color to green.

This setup will ensure that your matrix visual highlights cells in red when the demand is less than the allocated capacity and in green when the demand is greater than the allocated capacity.

Anonymous
Not applicable

Any help please?

 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.