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
Hey v-janeyg-msft ,
I understand of course. Here is an app which can be used as an example.
In the image below the color map should by column - so 2026 -red, 657 - red and the same logic for rest of the values. The color should be set on a column value by column value evaluation, instead of all values in the table.
The columns 5 ,6 and 7 are values of a single column which represents the month.
Best regards,
André
afbraga66 Can you share a sample fake data file?
- afbraga665 years agoHelper III
v-janeyg-msftwas in the post above. It is this one - https://we.tl/t-XlZUWPgAKL. The message ui won't let me add one in another way, so I add to put it on a link.
- v-janeyg-msft5 years agoCommunity Support
Hi, afbraga66
Try like this:
Measure = var a =MAXX(ALL(DOWNTIME[NOME_TIPO]),[mDuration(min)]) var b =MINX(ALL(DOWNTIME[NOME_TIPO]),[mDuration(min)]) return SWITCH(TRUE(),[mDuration(min)]=a,"Red",[mDuration(min)]=b,"Green","Yellow")Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please feel free to ask me.
Best Regards,Community Support Team _ Janey
- afbraga665 years agoHelper III
Hey v-janeyg-msft ,
It does work on the test file.
I tried to apply it to my report and this is the result. Overall is okay, not sure why there is no red color in the 7th month column for the 23,74 value. Any idea what could be causing it?
Best regards,
André