Forum Discussion

mohittimpus's avatar
mohittimpus
Icon for Helper V rankHelper V
6 years ago
Solved

Exact 12 month rolling

Hello...


I need exact 12 month rolling data. I have data from January  2019 to May 2020. In my data some month are missing in 2019 (may 2019 and june 2019). So I want include that missing month also for last 12 month Rolling. 

 

I have craeted measure :

 

last 12 month average = CALCULATE(
AVERAGE(employee[value]),
DATESINPERIOD( 'employee'[Date], MAX( 'employee'[Date] ), -12, MONTH ),VALUES(employee[Date])
)


but this measure is showing me 29.9 average but actual average 26.66 some thing. 

 

last 12 month will be May 2020 - June 2019 average will be 26.66 something but my measure is calculating 29.9. it is skipping the missing month may 2020 and june 2020 and after august 2019 it is considering april 2019. 

 

Below file is attached Excel and PBIX file both:

 

PBIX:

https://drive.google.com/file/d/1BBxzwGkgUAax5pmLC77uBsV6kS_PHguV/view?usp=sharing


Excel: 

https://drive.google.com/file/d/1uxuTWnh45xi5XpytyqgSueaqLZhO9u6J/view?usp=sharing

 

 

  • Hello @mohittimpus ,

    You can do this.

    last 12 month average = 
    VAR x = 
    CALCULATE(
        SUM(employee[value]),
        DATESINPERIOD( employee[Date], MAX(employee[Date]), -12, MONTH )
    ) 
    RETURN
    x/12

    v-lionel-msft_0-1600073359943.png

    Best regards
    Lionel Chen

    If this post helps,then consider Accepting it as the solution to help other members find it faster.

4 Replies