Forum Discussion
Aggregate Sum with specific dates
- 1 year ago
Hi Ben1981 , Muhammad_Ahmed
This solution has the right idea, but you are missing an ALL from th filter conditions.
See below my adjusted measure:NewMeasure = VAR currMonth = SELECTEDVALUE('Table'[Month]) VAR rolling4months = DATESINPERIOD('Table'[Month],currMonth,-4,MONTH) RETURN CALCULATE(SUM('Table'[Cust Count]),ALL(),'Table'[Data Type]="Current",'Table'[Month] IN rolling4months)
and a table comparing the results:"Measure" is the reference column from the example table provided. NewMeasure is my measure.
Hi,
Thank you for sharing your problem.
Can you try it out.
Rolling 4-Month Cust Count =
CALCULATE(
SUM('Table'[Cust Count]),
'Table'[Data Type] = "Current",
DATESINPERIOD(
'Table'[Month],
MAX('Table'[Month]),
-4,
MONTH
)
)
Hi Ben1981 , Muhammad_Ahmed
This solution has the right idea, but you are missing an ALL from th filter conditions.
See below my adjusted measure:
NewMeasure =
VAR currMonth = SELECTEDVALUE('Table'[Month])
VAR rolling4months = DATESINPERIOD('Table'[Month],currMonth,-4,MONTH)
RETURN
CALCULATE(SUM('Table'[Cust Count]),ALL(),'Table'[Data Type]="Current",'Table'[Month] IN rolling4months)
and a table comparing the results:
"Measure" is the reference column from the example table provided. NewMeasure is my measure.