Forum Discussion

powerbi1986's avatar
powerbi1986
Frequent Visitor
4 years ago
Solved

Average selected month

hi, can someone assist me

i would like to display average before and after in power bi

 

 

 

  • Hi,  powerbi1986
    You could create measures like the following:

    average after =
    AVERAGEX(
        FILTER(
            ALLSELECTED( 'table' ),
            'table'[month] > SELECTEDVALUE( 'table'[month] )
        ),
        [value]
    )

    average before =
    AVERAGEX(
        FILTER(
            ALLSELECTED( 'table' ),
            'table'[month] <= SELECTEDVALUE( 'table'[month] )
        ),
        [value]
    )

     

    Or, please share your sample pbix file's link here, then I can try to look into it to come up with a more accurate measure.

     

    Best Regards,
    Community Support Team _ Zeon Zheng

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

4 Replies

  • Hi powerbi1986 ,

     

    Not sure what you mean by Average before and after here.

    Add more details.

     

    Thanks,

    Pragati

    • powerbi1986's avatar
      powerbi1986
      Frequent Visitor

      sorry..

       

      if the selected month = jun

      average before = average from jan to jun
      average after = average from july to dec

       

      if the selected month = july

      average before = average from jan to july
      average after = average from aug to dec

  • Hi,  powerbi1986
    You could create measures like the following:

    average after =
    AVERAGEX(
        FILTER(
            ALLSELECTED( 'table' ),
            'table'[month] > SELECTEDVALUE( 'table'[month] )
        ),
        [value]
    )

    average before =
    AVERAGEX(
        FILTER(
            ALLSELECTED( 'table' ),
            'table'[month] <= SELECTEDVALUE( 'table'[month] )
        ),
        [value]
    )

     

    Or, please share your sample pbix file's link here, then I can try to look into it to come up with a more accurate measure.

     

    Best Regards,
    Community Support Team _ Zeon Zheng

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