Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hello,
I have a big problem that I can't solve with PowerBi
I want to make the following report :
from the following table :
management rules :
If the value in column "INDIC1" = "V" then colour in GREEN
If the value in column "INDIC1" = "F" then colour in RED
If the value in column "INDIC2" = "a " then colour in YELLOW
For dates, if the value of the date < TODAY then colour in GREEN, otherwise RED
How can I do this with PowerBi
I've tried using a matrix, but to no avail, as I can't colour in the INDIC1 and INDIC2 columns and 1 column without a date appears at date level, which I don't want.
I've tried another approach, which is to use an intermediate table (HEAD) to format the header of my matrix, but I can't do it, especially as I don't know how to make the dates, which are variable, appear in the header:
If anyone can help me, that would be great.
Thank’s a lot
My measures :
Table HEAD :
Table TAB01 :
Solved! Go to Solution.
HI @sebsenciel,
AFAIK, current conditional formatting feature not able to directly apply to the matrix visual header field and total levels. If you mean to apply condition formatting on value field based on current row and column field values, it is possible.
I'd like to suggest you do unpivot columns on these 'INDIC' fields to convert them to attribute and value.
Unpivot columns - Power Query | Microsoft Learn
Then you can add variables to extract the current field values and use them compare with conditions to get result color code.
Sample measure formulas:
ValueColor =
VAR currDate =
MAX ( Table1[Date] )
VAR currAttr =
SELECTEDVALUE ( Table1[Attribute] )
VAR currValue =
SELECTEDVALUE ( Table1[Value] )
RETURN
SWITCH (
currAttr,
"INDIC1", SWITCH ( currValue, "V", "GREEN", "F", "RED", "BLACK" ),
"INDIC2", IF ( currValue = "a ", "YELLOW", "BLACK" ),
"BLACK"
)
DateColor =
IF ( currDate < TODAY (), "GREEN", "RED" )
After these steps, you can use these formulas on value and date field background color to achieve your requirement.
Regards,
Xiaoxin Sheng
HI @sebsenciel,
AFAIK, current conditional formatting feature not able to directly apply to the matrix visual header field and total levels. If you mean to apply condition formatting on value field based on current row and column field values, it is possible.
I'd like to suggest you do unpivot columns on these 'INDIC' fields to convert them to attribute and value.
Unpivot columns - Power Query | Microsoft Learn
Then you can add variables to extract the current field values and use them compare with conditions to get result color code.
Sample measure formulas:
ValueColor =
VAR currDate =
MAX ( Table1[Date] )
VAR currAttr =
SELECTEDVALUE ( Table1[Attribute] )
VAR currValue =
SELECTEDVALUE ( Table1[Value] )
RETURN
SWITCH (
currAttr,
"INDIC1", SWITCH ( currValue, "V", "GREEN", "F", "RED", "BLACK" ),
"INDIC2", IF ( currValue = "a ", "YELLOW", "BLACK" ),
"BLACK"
)
DateColor =
IF ( currDate < TODAY (), "GREEN", "RED" )
After these steps, you can use these formulas on value and date field background color to achieve your requirement.
Regards,
Xiaoxin Sheng
Hello Xiaoxine Sheng,
Thank you for your reply
I've passed it on to OK because it's so nice of you to reply to me.
But, unfortunately I can't put the indexes + dates in columns on the same line.
There's something I don't understand at all.
If you have the time to attach a demo pbix, I'd really appreciate it.
But if not, forget it.
I don't understand why Microsoft hasn't made a matrix that lets you put colors in the header. I'm sorry, but in cobol in the 90's, it was possible to make matrices with colors... 30 years later, it's impossible with the new tools... find the error 😉
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
40 | |
4 | |
3 | |
3 | |
3 |