Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
sonya7
Helper III
Helper III

Making High/Low markers green-red on the line chart

Making High/Low balls green-red on the line chart. How can I make a graphical representation of any KPI to be selected on the line chart where total orders values ​​are displayed monthly, in a way that makes the highest value within the months green, the lowest value red and the remaining gray?

7 REPLIES 7
Ritaf1983
Super User
Super User

Hi @sonya7  To achieve the conditional formatting for line markers based on minimum/maximum value you can apply these steps (you didn't attach the dataset, so I used mine) :

1. Calculate min/max measures that ignore the date filter coming from the graph:

sum_for_min = CALCULATE(min(space_missions[Price]),ALLSELECTED('calendar'[Date]))
 
sum_for_Max =
CALCULATE(max(space_missions[Price]),ALLSELECTED('calendar'[Date]))
Ritaf1983_0-1698907841843.png

Then create a flag measure that checks if your measure is minimum/maximum/other

flag max_min_other = if([sum_price]=[sum_for_Max],1,if([sum_price]=[sum_for_min],2,0))
Ritaf1983_1-1698907989848.png

Then create a column chart + use the flag measure as a condition to format the columns' colors (we can't do it directly on a line chart )

Ritaf1983_2-1698908203115.png

Abd then just change the graph type to a line chart 

Ritaf1983_3-1698908265700.png

 

Note: My example is in blue/red and not green/red because the use of traffic light colors for emphasis is prohibited under the accessibility law. People with color blindness may not be able to see the difference...

PBIX is attached 

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

 

hello, thank you. But when I look at the file you sent, I see different values ​​in the table. That's why it was wrong in my own dataset too. Why might this problem occur? Can you put it in a table?

I also want it to be affected by the date filter, but it looks like yours is not.

 

sonya7_0-1698919918844.png

 

 

Hi @sonya7 
The graph is working with the slicer perfectly :

Ritaf1983_0-1698920318175.png

Ritaf1983_1-1698920370400.png

I didn't understand the first part of your question....please share your PBIX

 

Hi @sonya7 

This is a complex model, and regrettably, I lack the time to recreate it.

For instance, I didn't understand why you were using dates from different tables. To achieve the desired visualization, you typically need a fact table and its associated dimension date table properly connected.

 



I added a date table.  Can you try it like this? I want the above chart to be a line chart and I want the max value to be green and the min value to be red. I wrote the same formulas as yours.

 

https://drive.google.com/file/d/1Vn8KcHdnDxxv70hCMcUU5BCHtNwzqYxV/view?usp=sharing

Hi @sonya7 
I see that the relationship with the dates table still doesn't work as it should ....

Ritaf1983_0-1698926120072.png

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.