Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I'm trying to create a measure to get Previous year YTD Sales but having trouble converting SamePeriodLastYear in form of Calculate (i.e. Third Method in my code).
I'm using ContosoDw for reference and below is code of two measure.
PY YTD Sales =
/*
// Method One
CALCULATE (
[SalesAmount],
SAMEPERIODLASTYEAR ( DATESYTD ( 'Date'[Date] ) )
)*/
// Second Method
CALCULATE (
[SalesAmount],
DATESYTD ( SAMEPERIODLASTYEAR ( 'Date'[Date] ) )
)
/*
// Third Method
CALCULATE (
[SalesAmount],
FILTER (
ALL ( 'Date' ),
AND (
'Date'[Date] >= DATE(YEAR(DATEADD('Date'[Date] ,-1,YEAR)),1,1),
// 'Date'[Date] <= DATE (YEAR(DATEADD('Date'[Date] ,-1,YEAR)), MONTH('Date'[Date]), DAY('Date'[Date]) )
'Date'[Date] <= DATE (YEAR(DATEADD('Date'[Date] ,-1,YEAR)),3,31)
)
)
)*/Below SS while using Third Method
See if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.
https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 5 | |
| 5 | |
| 4 |
| User | Count |
|---|---|
| 25 | |
| 16 | |
| 8 | |
| 7 | |
| 7 |