Forum Discussion

GJD23's avatar
GJD23
Frequent Visitor
1 year ago

END OF MONTH - what am i doing wrong

Test Period end = ENDOFMONTH('AOP DATA'[Mid Mth Date])
 
I have a data table that has a mid month date calculated within the data - always 15th of the month. I also have a calendar table
 
In trying to calculate Aggregate yearly sales i have tried to use above formula to cretae an end Period for the agreate sales.
 
However when i check the result of the formula it is still returning the 15th of the month - I must bed doing something basic in correctly!!!
 
My full formula is 
AOP Aggregate Sales =
VAR PeriodStart = STARTOFYEAR('AOP DATA'[Mid Mth Date])
VAR PeriodEnd = ENDOFMONTH('AOP DATA'[Mid Mth Date])

VAR AggSales = CALCULATE(SUM('AOP DATA'[Value]), 'Calendar'[Date] >= PeriodStart &&'Calendar'[Date] <= PeriodEnd)
   
    Return AggSales
 
which i thought waas working but on checking think the period end date is causing an issue

2 Replies