Hi Carlos,
Your =Calculate([Total sales], SAMEPERIODLASTYEAR('Calendar'[Date]) formula should work.
- Check the data to ensure there is sales in those past periods.
- Check the context of the PIVOT table where you are using you measure.
- Check the relationship is setup correctly.
I use the same formula in the snapshot below and you can see the "Prior" sales highlighted in yellow. Note that the prior sales in Jan, Feb, Mar of 2023 in my Pivot are blank because there is no data for those periods.