Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
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!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
58 | |
58 | |
56 | |
38 | |
29 |
User | Count |
---|---|
75 | |
62 | |
45 | |
40 | |
39 |