Forum Discussion
Conditional formatting on specific row in matrix based on the value in that row
Hi,
I've created a P&L statement in Power BI, by using a model in Excel and used that for a matrix table.
This is the model:
Then I created several measures. The measure that is added to the matrix is this one:
BEDRAGEN =
VAR KEUZE = SELECTEDVALUE('MODEL_RESREK'[Item])
Return
SWITCH(TRUE(),
KEUZE = "OMZET", [OMZET TOTAAL],
KEUZE = "KOSTPRIJS TOTAAL", [INKOOPWAARDE TOTAAL],
KEUZE = "BRUTO-RESULTAAT", [BRUTO-RESULTAAT],
KEUZE = "KOSTEN TOTAAL", [KOSTEN TOTAAL],
KEUZE = "NETTO-RESULTAAT", [NETTO-RESULTAAT],
CALCULATE(Meting[TOT_BEDRAGEN], FILTER(KOPPELING, KOPPELING[Sub-categorie]=keuze)))
The matrix works:
Now for NETTO-RESULTAAT I want to conditionally format, where the background of a positive number is green and a negative number is red.
All I've managed so far is turning the entire row Yellow with this measure and then using it as a conditional formatting on BEDRAGEN:
color = if(max(MODEL_RESREK[Item_lay-out]) ="NETTO-RESULTAAT", "Yellow", "White")
So how do I get to the next step? Any help is very much appreciated.
Try:
color = IF ( AND ( MAX ( MODEL_RESREK[Item_lay-out] ) = "NETTO-RESULTAAT", [BEDRAGEN] < 0 ), "Red", IF ( AND ( MAX ( MODEL_RESREK[Item_lay-out] ) = "NETTO-RESULTAAT", [BEDRAGEN] > 0 ), "Green", "White" ) )
5 Replies
- PaulDBrown
Community Champion
Try:
color = IF ( AND ( MAX ( MODEL_RESREK[Item_lay-out] ) = "NETTO-RESULTAAT", [BEDRAGEN] < 0 ), "Red", IF ( AND ( MAX ( MODEL_RESREK[Item_lay-out] ) = "NETTO-RESULTAAT", [BEDRAGEN] > 0 ), "Green", "White" ) ) - DataZoe
Microsoft Employee
Have you tried something like this:
color =
SWITCH( TRUE(),
max(MODEL_RESREK[Item_lay-out]) ="NETTO-RESULTAAT", "Yellow",
[BEDRAGEN] > 0, "Green",
[BEDRAGEN] < 0, "Red",
"White")