Forum Discussion

Happy2023_05's avatar
Happy2023_05
Icon for Helper I rankHelper I
3 years ago
Solved

Two Average/Mean Lines in Power BI

Hi,

In scatter plot,I need to create 2 average lines one line should be static and other line should not change. For eg suppose Us has avg sales of 50 k this should be static and other avg line should change based on state selection.For eg California can hav avg sal of 20 k and Atlanta can hav 10k.so the 2nd line should change based on filter selection but 1st line should not have any impact. Can some one help me on how to achieve this in DAX or any other method.Thanks in Advance.

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Happy2023_05 ,

    To create two average lines in a scatter plot, one static and one dynamic, you can use the following steps:

    1. Create a measure for the static average.

    Static Average = AVERAGE(Table[Sales])

    2. Create a measure for the dynamic average line.

    Dynamic Average =
    CALCULATE ( AVERAGE ( Table[Sales] ), ALLEXCEPT ( Table, Table[State] ) )
    

    3. Add both measures to the values section of the scatter plot. You can change their color, transparency, line style, and position.

    4. Add a slicer for the state column to your report. When you select a state from the slicer, the dynamic average line will change accordingly, but the static average line will remain constant.

     

    How to Get Your Question Answered Quickly 

     

    If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

     

    Best Regards
    Community Support Team _ Rongtie

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

     

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Happy2023_05 ,

    To create two average lines in a scatter plot, one static and one dynamic, you can use the following steps:

    1. Create a measure for the static average.

    Static Average = AVERAGE(Table[Sales])

    2. Create a measure for the dynamic average line.

    Dynamic Average =
    CALCULATE ( AVERAGE ( Table[Sales] ), ALLEXCEPT ( Table, Table[State] ) )
    

    3. Add both measures to the values section of the scatter plot. You can change their color, transparency, line style, and position.

    4. Add a slicer for the state column to your report. When you select a state from the slicer, the dynamic average line will change accordingly, but the static average line will remain constant.

     

    How to Get Your Question Answered Quickly 

     

    If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

     

    Best Regards
    Community Support Team _ Rongtie

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