Forum Discussion

mircea's avatar
mircea
Icon for Helper I rankHelper I
4 years ago
Solved

Adding an average line that excludes current month

Hello,

 

I have the following chart that has an average line

 

 

 

 

The problem is that I don't want the current month to be included in the average calculation.

Chart axis:

 

 

Please help.

Regards

 

  • Instead of using the built-in Average line, use the Y-Axis Constant Line and use a measure defined the way you want.

     

    Here's an example measure that excludes the final month:

    SpecialAvg =
    CALCULATE (
        AVERAGE ( Table1[Value] ),
        FILTER ( ALLSELECTED ( Table1[Month] ), Table1[Month] < MAX ( Table1[Month] ) )
    )

4 Replies

  • Instead of using the built-in Average line, use the Y-Axis Constant Line and use a measure defined the way you want.

     

    Here's an example measure that excludes the final month:

    SpecialAvg =
    CALCULATE (
        AVERAGE ( Table1[Value] ),
        FILTER ( ALLSELECTED ( Table1[Month] ), Table1[Month] < MAX ( Table1[Month] ) )
    )
  • Thank you Alexis, appreciate your help.

    I created this measure but instead of a horizontal line, I get a broken line by month (dark blue). 

     

     

    • AlexisOlson's avatar
      AlexisOlson
      Icon for Super User rankSuper User

      It looks like you put it in the visual as a measure instead of a Y-Axis Constant line under the Analytics pane as I suggested.

      • mircea's avatar
        mircea
        Icon for Helper I rankHelper I

        Sorry, just learning Power BI now :). Marked as solution!