Forum Discussion
vijay273162
Helper III
4 years agoSAME PERIOD LAST YEAR
Hi All, basic Question from my side. HOW TO USE SAME PERIOD LAST YEAR ---- in ----- calculated columns ?
- 4 years ago
Hi vijay273162
If you are using dates from a fact table, try this way,
column = VAR _date = EDATE ( 'Table'[Date], -12 ) RETURN CALCULATE ( SUM ( 'Table'[Sales] ), FILTER ( ALL ( 'Table' ), 'Table'[Date] >= _date && 'Table'[Date] < EARLIER ( 'Table'[Date] ) ) )If you want to create measure, then try this
LY = CALCULATE(SUM('Table'[Sales]),SAMEPERIODLASTYEAR('Table'[Date]))Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
v-xiaotang
Community Support
4 years agoHi vijay273162
If you are using dates from a fact table, try this way,
column =
VAR _date =
EDATE ( 'Table'[Date], -12 )
RETURN
CALCULATE (
SUM ( 'Table'[Sales] ),
FILTER (
ALL ( 'Table' ),
'Table'[Date] >= _date
&& 'Table'[Date] < EARLIER ( 'Table'[Date] )
)
)
If you want to create measure, then try this
LY = CALCULATE(SUM('Table'[Sales]),SAMEPERIODLASTYEAR('Table'[Date]))
Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
YoungLearning
Helper III
2 years agoIs SUM necessary?
This answer looks wrong too, can someone educate me a little here? I was assuming it's SAMEPERIODLASTYEAR.