Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
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.
Solved! Go to Solution.
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"
)
)
Proud to be a Super User!
Paul on Linkedin.
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"
)
)
Proud to be a Super User!
Paul on Linkedin.
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"
)
Respectfully,
Zoe Douglas (DataZoe)
Follow me on LinkedIn at https://www.linkedin.com/in/zoedouglas-data
See my reports and blog at https://www.datazoepowerbi.com/
Hi, this somehow turned all the other rows green and the row NETTO-RESULTAAT is still yellow. 🙂
@JoyceW Can you provide more details?
Here I have it set up like this:
And [PL Amount] is like this:
Respectfully,
Zoe Douglas (DataZoe)
Follow me on LinkedIn at https://www.linkedin.com/in/zoedouglas-data
See my reports and blog at https://www.datazoepowerbi.com/
Thanks for the detailed answer. It's hard for me to explain sometimes, since I'm still a beginner. Paul's solution worked!