Forum Discussion
Color matrix by column total
- 4 years ago
Hi, afbraga66
You can try:
Color Measure = var c =SUMMARIZE(ALLSELECTED(DOWNTIME),DOWNTIME[NOME_TIPO],DOWNTIME[MES_FABRIL],"sum",SUM(DOWNTIME[Duration Minutes])) var a =MAXX(FILTER(c,[MES_FABRIL]=SELECTEDVALUE(DOWNTIME[MES_FABRIL])),[sum]) var b =MINX(FILTER(c,[MES_FABRIL]=SELECTEDVALUE(DOWNTIME[MES_FABRIL])),[sum]) return IF(ISINSCOPE(DOWNTIME[NOME_TIPO])&&NOT(ISINSCOPE(DOWNTIME[COD_OP])),SWITCH(TRUE(),[mDuration(min)]=a,"Red",[mDuration(min)]=b,"Green","Orange"))I use summraize funtion to generate a virtual table with the same values like your matrix visual then use it to calculate.
If you use expand or collapse, you can use isinscope funtion or isfilter funtion to calculate the results of the main and hierarchical levels separately.
There is no one-time formula. When you use matrix visualization and have multiple row fields, the context becomes more complicated, and the code needs to be modified as the logic changes.
SUMMARIZE function (DAX) - DAX | Microsoft Docs
ISINSCOPE function (DAX) - DAX | Microsoft Docs
Did I answer your question ? Please mark my reply as solution. Thank you very much.
Best Regards,Community Support Team _ Janey
Hi, afbraga66
Have you tried the advice I gave you before(all to allselected)? The problem may be here. 'filter on this page' will filter some rows, which contain data that you might meet the conditional format. You can delete it to see if it is displayed correctly.
You need to add the conditions in the maximum and minimum places.
Like this:
I will be on vacation for a while,so can't reply in time. Hope you can understand what I mean.
Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please upload some insensitive data samples and expected output.
Best Regards,
Community Support Team _ Janey
Hi v-janeyg-msft ,
I understand, have a nice time on your vacations.
Just on a side note, I tried the allselected but was the same. Additionally the MAXX is giving syntax erro because it only takes 2 parameters, and in your example you are adding a third.
Thank you.
Best regards,
André