Forum Discussion

jitpbi's avatar
jitpbi
Post Patron
6 years ago
Solved

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

  • Anonymous's avatar
    Anonymous
    6 years ago

    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)

     


    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.

3 Replies

  • 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

  • Anonymous's avatar
    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)

     


    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.