Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Average for EACH month only

 

Hi I want to create an average only for each month, for example avg Jan : 10, Feb : 12.5, March : 17.5

So every month has different value

 

  • Anonymous's avatar
    Anonymous
    5 years ago

    HI Anonymous,

    You can create a measure formula to calculate the aggregate value based on your date field 'year' and 'month' parts.

    Measure formula:

     

    Measure =
    VAR currDate =
        MAX ( Table[Date] )
    RETURN
        CALCULATE (
            AVERAGE( Table[Amount] ),
            FILTER (
                ALLSELECTED ( Table ),
                YEAR ( [Date] ) = YEAR ( currDate )
                    && MONTH ( [Date] ) = MONTH ( currDate )
            )
        )

     

    Regards,

    Xiaoxin Sheng

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    HI Anonymous,

    You can create a measure formula to calculate the aggregate value based on your date field 'year' and 'month' parts.

    Measure formula:

     

    Measure =
    VAR currDate =
        MAX ( Table[Date] )
    RETURN
        CALCULATE (
            AVERAGE( Table[Amount] ),
            FILTER (
                ALLSELECTED ( Table ),
                YEAR ( [Date] ) = YEAR ( currDate )
                    && MONTH ( [Date] ) = MONTH ( currDate )
            )
        )

     

    Regards,

    Xiaoxin Sheng