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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Victor_Z
Frequent Visitor

Matrix Conditional formating based on row value

Hello everybody,

I have a matrix table where:

  • Rows shows different business process of the company
  • Columns shows the availability of that process for each month
  • Values: meausure of the availability 

The thing is that I need to have different background formating for the values depeding of each row of the Matrix (business service).

For example, for the business services A, Matrix cell value will be red if the measure is below 99,7 % . But for the business services C, Matrix cell value will be red if the measure is below 99,8 % , or red if below 99,5 % in case of business process D.

After doing some reseearch  I have managed to work it out by using rule background formatting 

 

Victor_Z_0-1697538137360.png

 

Based on the following meausure: 

Availab. Color Monthly = MAXX(‘Table’,

IF(‘Table’[Business Process]="Business Process_A" && [Availab. Monthly] < 0.997,1,

    IF(‘Table’[Business Process]= " Business Process_B" && [Availab. Monthly] < 0.997,2,

    IF(‘Table’[Business Process]=" Business Process_C" && [Availab. Monthly] < 0.998,3,

    IF(‘Table’[Business Process]=" Business Process_D" && [Availab. Monthly] < 0.995,4,

               …

               …              

    IF(‘Table’[Business Process]=" Business Process_M" && [Availab. Monthly] < 0.995,13)))

 

However is not working properly as there are some values that are not being red coloured when it should (orange circle) as the picture attached shows. 

Victor_Z_1-1697539169865.png

 

Does anyone knows what could be happening?. 

Thanks a lot for your help!

1 ACCEPTED SOLUTION

Hi @Victor_Z ,

I noticed that the data type of [Availab.] is the decimal number.

vcgaomsft_0-1697763808121.png
99.98 converted to percentage format is 9980%

vcgaomsft_1-1697763829304.png

I edited the measure and checked to see if this was causing the problem.

Availab. Monthly_Color = SWITCH(
    MAX('Incidents Analysis'[Bussiness Process]),
    "BUSINESS PROCESS A",IF([Availab. Monthly]<99.7,"red"),
    "BUSINESS PROCESS B",IF([Availab. Monthly]<99.7,"red"),
    "BUSINESS PROCESS C",IF([Availab. Monthly]<99.8,"red"),
    "BUSINESS PROCESS D",IF([Availab. Monthly]<99.5,"red"),
    "BUSINESS PROCESS E",IF([Availab. Monthly]<99.8,"red"),
    "BUSINESS PROCESS F",IF([Availab. Monthly]<99.7,"red"),
    "BUSINESS PROCESS G",IF([Availab. Monthly]<99.8,"red"),
    "BUSINESS PROCESS H",IF([Availab. Monthly]<99.8,"red"),
    "BUSINESS PROCESS I",IF([Availab. Monthly]<99.9,"red"),
    "BUSINESS PROCESS J",IF([Availab. Monthly]<99.8,"red"),
    "BUSINESS PROCESS K",IF([Availab. Monthly]<99.5,"red"),
    "BUSINESS PROCESS L",IF([Availab. Monthly]<99.5,"red"),
    "BUSINESS PROCESS M",IF([Availab. Monthly]<99.5,"red")
)

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

9 REPLIES 9
wasirafi
Helper I
Helper I

@lbendlin  if i want to get another color "green" for values greater than 99.5, i modified the DAX to below

Availab. Monthly_Color = SWITCH(
    MAX('Incidents Analysis'[Bussiness Process]),
    "BUSINESS PROCESS A",IF([Availab. Monthly]<99.7,"red"),
    "BUSINESS PROCESS A",IF([Availab. Monthly]>99.7,"Green")    
)

 However i dont get the green color. what am i doing wrong in this.

Availab. Monthly_Color = SWITCH(
    MAX('Incidents Analysis'[Bussiness Process]),
    "BUSINESS PROCESS A",IF([Availab. Monthly]<99.7,"red","Green")    
)
v-cgao-msft
Community Support
Community Support

Hi @Victor_Z ,

Please create a new measure like:

Availab. Color Monthly = 
SWITCH(
    MAX('Table'[Business Process]),
    "Business Process_A",IF([Availab. Monthly]<0.997,"red"),
    "Business Process_C",IF([Availab. Monthly]<0.998,"red"),
    "Business Process_D",IF([Availab. Monthly]<0.995,"red"),
    <the other condtions>
)

vcgaomsft_0-1697697691704.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

SLA Red colored.pnghi @v-cgao-msft 

Thanks a lot for your help. I have created the new measure and the result it is quite better. There is just one value that is not red colored, quite wierd...

Please check the picture attached

Hi @Victor_Z ,

I'm not sure. 
Is there no value in this row? What is your modified measure?

vcgaomsft_0-1697710397941.png

It would be helpful to consider providing a file that does not contain private data.

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

 @Hi @v-cgao-msft 

Please find below the meausure.

 

 

 

Availab. Monthly_Color = SWITCH(
    MAX('Incidents Analysis'[Bussiness Process]),
    "BUSINESS PROCESS_A",IF([Availab. Monthly]<0.997,"red"),
    "BUSINESS PROCESS_B",IF([Availab. Monthly]<0.997,"red"),
    "BUSINESS PROCESS_C",IF([Availab. Monthly]<0.998,"red"),
    "BUSINESS PROCESS_D",IF([Availab. Monthly]< 0.995,"red"),
    "BUSINESS PROCESS_E",IF([Availab. Monthly]<0.998,"red"),
    "BUSINESS PROCESS_F",IF([Availab. Monthly]<0.997,"red"),
    "BUSINESS PROCESS_G",IF([Availab. Monthly]< 0.998,"red"),
    "BUSINESS PROCESS_H",IF([Availab. Monthly]< 0.998,"red"),
    "BUSINESS PROCESS_I",IF([Availab. Monthly]<0.999,"red"),
    "BUSINESS PROCESS_J",IF([Availab. Monthly]<0.998,"red"),
    "BUSINESS PROCESS_K",IF([Availab. Monthly]<0.995,"red"),
    "BUSINESS PROCESS_L",IF([Availab. Monthly]< 0.995,"red"),
    "BUSINESS PROCESS_M",IF([Availab. Monthly]< 0.995,"red")
)

 

 

 

 The problem only appears with the Row "Business Process F". 

 

IncidentOpened dateBussiness ProcessSLA Impact sgYearWeekMonthDayImpacted TimeAvailab.
INC00000154380610/10/2023BUSINESS PROCESS A4102023421010/100:06:5099,98%
INC00000154380610/10/2023BUSINESS PROCESS C3352023421010/100:05:3599,99%
INC00000154315210/10/2023BUSINESS PROCESS M31202023421010/100:52:0099,88%
INC00000154315210/10/2023BUSINESS PROCESS K31202023421010/100:52:0099,88%
INC00000154366510/10/2023BUSINESS PROCESS B8402023421010/100:14:0099,97%
INC00000154338309/10/2023BUSINESS PROCESS A144002023421010/94:00:0099,44%
INC00000154368809/10/2023BUSINESS PROCESS C12002023421010/90:20:0099,95%
INC00000154083103/10/2023BUSINESS PROCESS A108002023411010/33:00:0099,58%
INC00000154002029/09/2023BUSINESS PROCESS C1710020234099/294:45:0099,34%
INC00000154002029/09/2023BUSINESS PROCESS A1260020234099/293:30:0099,51%
INC00000153937929/09/2023BUSINESS PROCESS F240020234099/290:40:0099,91%
INC00000153937929/09/2023BUSINESS PROCESS H240020234099/290:40:0099,91%
INC00000153879928/09/2023BUSINESS PROCESS F020234099/280:00:00100,00%
INC00000153742025/09/2023BUSINESS PROCESS A90020234099/250:15:0099,97%
INC00000153713925/09/2023BUSINESS PROCESS C3420020234099/259:30:0098,68%
INC00000153713925/09/2023BUSINESS PROCESS A3420020234099/259:30:0098,68%
INC00000153616822/09/2023BUSINESS PROCESS F1170020233999/223:15:0099,55%
INC00000153616822/09/2023BUSINESS PROCESS H1170020233999/223:15:0099,55%
INC00000153383022/09/2023BUSINESS PROCESS K810020233999/222:15:0099,69%
INC00000153383022/09/2023BUSINESS PROCESS M810020233999/222:15:0099,69%
INC00000153355021/09/2023BUSINESS PROCESS M900020233999/212:30:0099,65%
INC00000153355021/09/2023BUSINESS PROCESS K900020233999/212:30:0099,65%
INC00000152975408/09/2023BUSINESS PROCESS C630020233799/81:45:0099,76%
INC00000152975408/09/2023BUSINESS PROCESS C1260020233799/83:30:0099,51%

Thanks.

Hi @Victor_Z ,

I noticed that the data type of [Availab.] is the decimal number.

vcgaomsft_0-1697763808121.png
99.98 converted to percentage format is 9980%

vcgaomsft_1-1697763829304.png

I edited the measure and checked to see if this was causing the problem.

Availab. Monthly_Color = SWITCH(
    MAX('Incidents Analysis'[Bussiness Process]),
    "BUSINESS PROCESS A",IF([Availab. Monthly]<99.7,"red"),
    "BUSINESS PROCESS B",IF([Availab. Monthly]<99.7,"red"),
    "BUSINESS PROCESS C",IF([Availab. Monthly]<99.8,"red"),
    "BUSINESS PROCESS D",IF([Availab. Monthly]<99.5,"red"),
    "BUSINESS PROCESS E",IF([Availab. Monthly]<99.8,"red"),
    "BUSINESS PROCESS F",IF([Availab. Monthly]<99.7,"red"),
    "BUSINESS PROCESS G",IF([Availab. Monthly]<99.8,"red"),
    "BUSINESS PROCESS H",IF([Availab. Monthly]<99.8,"red"),
    "BUSINESS PROCESS I",IF([Availab. Monthly]<99.9,"red"),
    "BUSINESS PROCESS J",IF([Availab. Monthly]<99.8,"red"),
    "BUSINESS PROCESS K",IF([Availab. Monthly]<99.5,"red"),
    "BUSINESS PROCESS L",IF([Availab. Monthly]<99.5,"red"),
    "BUSINESS PROCESS M",IF([Availab. Monthly]<99.5,"red")
)

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Hi  @v-cgao-msft 

That´s not the problem. It is not related with the data type. it seems that in that particular case, 

BUSINESS PROCESS F",IF([Availab. Monthly]<99.7,"red"),

 

and for that specific month (March --> Availab. = 99.53) the formula is not working...   It is quite strange.

Any idea? 

lbendlin
Super User
Super User

Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot). Leave out anything not related to the issue.
If you are unsure how to do that please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.

If you want to get answers faster please refer to https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.