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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
jitpbi
Post Patron
Post Patron

Highlight Maximum Deviation

Hi,

 

On a line chart visual, "actual sales" and "target sales" are on Y-axis and "date" is on X-axis . On the secondary Y-axis, showing the "difference" (actual and target sales).

I have to highlight the highest "difference" ( with different colour/marker) on the chart.

 

Please help me out to achieve this.

 

Thanks

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@jitpbi 
First create a difference column between actual and target sales:

 

Diff= 
VAR a = [actual sales]-[target sales]
Return 
VALUE(RIGHT(a,LEN(a)- IFERROR(FIND("-",a),0)))

 

Then flag the highest difference with measure:

 

Measure = IF(SUM('Table'[Diff])=CALCULATE(MAX([Diff]),ALL('Table')),1,0)

 

highlight max.JPG


Paul Zheng _ Community Support Team
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

@jitpbi 
First create a difference column between actual and target sales:

 

Diff= 
VAR a = [actual sales]-[target sales]
Return 
VALUE(RIGHT(a,LEN(a)- IFERROR(FIND("-",a),0)))

 

Then flag the highest difference with measure:

 

Measure = IF(SUM('Table'[Diff])=CALCULATE(MAX([Diff]),ALL('Table')),1,0)

 

highlight max.JPG


Paul Zheng _ Community Support Team
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Fowmy
Super User
Super User

@jitpbi 

Try like

FormatMeasure = 
VAR MaxAmount = CALCULATE(MAXX(VALUES('Table'[Difference]),[Sales Amount]),ALL('Table'[Region]))
VAR LineAmonut = [Actual]
RETURN 
SWITCH (
    TRUE(),
    LineAmonut = MaxAmount, "GREEN",
    LineAmonut = MinAmount, "RED"
)  

 

________________________

Did I answer your question? Mark this post as a solution, this will help others!.

Click on the Thumbs-Up icon on the right if you like this reply 🙂

YouTube, LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

amitchandak
Super User
Super User

@jitpbi , I doubt conditional format work with more than one measure.

You can create two-measure highest and lowest difference and plot them with a marker .

 

use the idea used in -https://community.powerbi.com/t5/Community-Blog/Display-Label-Only-on-the-Last-Data-Point-of-the-Lin...

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.