Forum Discussion

hitesh1607's avatar
hitesh1607
Advocate II
5 years ago
Solved

Average on Measure

I have a measure to calculate the Rolling Count

 
RollingMeasure = VAR MaxDate = MAX ( 'Date'[Date] ) 
RETURN
CALCULATE (
COUNT(fctTable[ID]), 
fctTable[HireDate] <= MaxDate, 
ALL ( Date) 
)
 
I need to create a new measure to get the Sum of RollingMeasure for Previous year (all the 12 months sum)
(i already have relative year field in Date table which we can use by adding filter where "RelativeYear = -1")
 
Also, I need an average for a complete Previous year based on RollingMeasure 
 
Thank you
 
 
 
 
  • Hi hitesh1607,

     

    Have you resolved it? If not, you could reference my way to have a try:

    RollingMeasure =
    CALCULATE (
        SUM ( 'Table'[Values] ),
        FILTER (
            ALL ( 'Date' ),
            'Date'[Date] <= MAX ( 'Date'[Date] )
                && 'Date'[Year] = MAX ( 'Date'[Year] )
        )
    )
    
    Avg =
    AVERAGEX (
        FILTER ( ALLSELECTED ( 'Date' ), 'Date'[Year] = MAX ( 'Date'[Year] ) - 1 ),
        [RollingMeasure]
    )
    

     

    If this can't help you, please share some sample data and expected result with us. Thanks.

     

6 Replies