Forum Discussion
Rolling Interval Calculation
Hi,
My dataset is as follows
Year Month Day_of_Month Values
. . . .
2017 12 31 5
2018 1 1 10
2018 1 2 20
and so on
I want to calculate Rolling Interval Calculation on basis of filter rolling interval (1-12)
If i select interval 1 then formula should give aggegated measure for past 30 days,
if i select interval 2 then formula should give aggregated measure for past 60 days and so on.
So far i am using the below mentioned formula which aggregates monthwise only i.e for 1-jan-2018 the calculation should show sum of values for 2-dec-2017 to 1-jan-2018. My calculation currently aggregates only inside a month so for 1-jan-2018 it shows the same value 10.
SumValues=Sum([Values])
Rolling inteval calculation :-IF([Selected Interval]=1,
CALCULATE([SumValues],
DATESINPERIOD(Table[DATE],LASTDATE(Table[DATE]),-30,DAY)
),
IF([Selected Interval]=2,
CALCULATE(Table[SumValues],
DATESINPERIOD(Table[DATE],LASTDATE(Table[DATE]),-60,DAY)
)
)
Please help.
Thanks in advance
Power BI User
8 Replies
- LivioLanzoSolution Sage
Hi Anonymous,
the correct way to handle this is through the creation of a Date dimension table but it does not look like it is the case for you?
- AnonymousNot applicable
I don't have a date dimension , but a date column in my Table
Power BI User
- LivioLanzoSolution Sage
Anonymous
you need to start by creating one: http://radacad.com/create-a-date-dimension-in-power-bi-in-4-steps-step-1-calendar-columns