Conditional formatting line chart min and max

Hi everyone,

I have a line chart with revenue per month. I want the lowest and the highest month highlighted with red for low and green for high. I used this video: https://www.youtube.com/watch?v=hmk6PxDtbNs&t=0s

And created this measure:

MaxMin Omzet =
VAR Omzet = [Omzet]
VAR MAXOmzet =
MAXX(
ALLSELECTED(Datumtabel[Jaar], Datumtabel[Maand], Datumtabel[Maandnr]),
[Omzet]
)
VAR MinOmzet =
MINX(
ALLSELECTED(Datumtabel[Jaar], Datumtabel[Maand], Datumtabel[Maandnr]),
[Omzet]
)
VAR Result =
SWITCH(
TRUE(),
[Omzet]=MAXOmzet, “Green” || [Omzet]=MinOmzet, “Red”,
“blue”
)
RETURN Result

The video says to turn it to a column chart and with column color select the fx next to color. then select field value and then the measure. But I cannot select the measure. I have tried setting the measure to text, but that is not an option. What am I doing wrong? :slight_smile:

Is there no one who has a solution?

Bumping this post for more visibility from our experts and users.

1 Like

Hi @JoycevW - I think the issue is with below line.

SWITCH(
TRUE(),
[Omzet]=MAXOmzet, “Green” || [Omzet]=MinOmzet, “Red”

It should be comma instead of || like [Omzet]=MAXOmzet, “Green”, [Omzet]=MinOmzet, “Red”

Also, I have tested on sample file and it is working for me. If above doesn’t resolve the issue, share your PBIX file.

UBG To Power BI - Model.pbix (701.5 KB)

Thanks
Ankit J

Yes!!! It works! Thank you so much! :slight_smile:

2 Likes

@JoycevW - Thanks for confirming. Please mark this post as solved.