Forum Discussion
Building a P&L in Power BI (conditional formatting)
Hi Community,
I have been watching Matt Allington's video on how to build a P&L in Power BI. This is very informative.
Video
https://exceleratorbi.com.au/building-a-pl-in-power-bi-part-2-percentages/
The Matrix he created has one Measure in the Values section of the matrix:
If you were to use conditional formatting on his matrix with different color combinations everything works fine, but the section that has percentages cannot be formatted with any color, due to it being read as text and not a number. Is there a way to add some color to the percentages with some Hex code by tweaking his syntax? E.g if the percentage is negative add red color to it, or if positive then add green color?
darko861 , Create one additional measure without this format, then you can create a conditional formatting based on that.
You can also create a color measure, where you can return color based on CalcType and measure value and use that in conditional formatting using the filed value option
example
color =
switch ( true(),
FIRSTNONBLANK('Table'[commodity],"NA") ="commodity1" && sum('Table'[Value]) >500,"lightgreen",
FIRSTNONBLANK('Table'[commodity],"NA") ="commodity2" && sum('Table'[Value]) >1000,"lightgreen",
// Add more conditions
"red"
)How to do conditional formatting by measure and apply it on pie?: https://youtu.be/RqBb5eBf_I4
2 Replies
- amitchandak
Super User
darko861 , Create one additional measure without this format, then you can create a conditional formatting based on that.
You can also create a color measure, where you can return color based on CalcType and measure value and use that in conditional formatting using the filed value option
example
color =
switch ( true(),
FIRSTNONBLANK('Table'[commodity],"NA") ="commodity1" && sum('Table'[Value]) >500,"lightgreen",
FIRSTNONBLANK('Table'[commodity],"NA") ="commodity2" && sum('Table'[Value]) >1000,"lightgreen",
// Add more conditions
"red"
)How to do conditional formatting by measure and apply it on pie?: https://youtu.be/RqBb5eBf_I4
- darko861
Resolver II
Thank you!