Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
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 😉
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
6 | |
1 | |
1 | |
1 | |
1 |
User | Count |
---|---|
10 | |
2 | |
2 | |
2 | |
2 |