Forum Discussion
YTD vs Previous YTD
- 2 years ago
PBI file attached.
Hope this helps.
Hi,
Try this approach
- Create a Calendar Table with calculated column formulas for Year, Month name and Month number. Sort the Month name column by the Month number
- Create a relationship (Many to One and Single) from the Date column of your Data Table to the Date column of the Calendar Table
- To your visual/filter/slicer, drag Year and Month name from the Calendar Table
- Select an year in the slicer
- Write these measures
Total = SUM('Query1 (AC)'[[Units])Total YTD = CALCULATE([Total],DATESYTD(Calendar[Date],"31/12"))Total YTD SPLY = calculate([Total YTD],sameperiodlastyear(calendar[date]))
Hope this helps.
- o593932 years ago
Post Prodigy
Your measures worked, but if I click on the 2024 year, the PY values wont appear on the column "PY YTD AC"
How can I reflect the sales for Jan 2023 and Feb 2023 next to the Jan 2024 and Feb 2024 rows of the table intead of blanks?
The other thing that caught my attention was the the matrix on the right says the following:
I attach pbix:
Thanks a lot.
- Ashish_Mathur2 years ago
Super User
You have not followed any of the steps which i mentioend in my previous post. I do not see any Calendar Table at all. Read and implement properly.
- o593932 years ago
Post Prodigy
Sorry about that, here is the pbix updated.
I created the calendar table with the columns you mentioned from my power query.
Still not showing the PY value and the matrix gives the error.
Can you please have a look? sample_sameperiod.pbix
Thanks.