Forum Discussion
Dynamic Weeks Year Over Year Time Series Chart
I have weekly data for the past two years. My goal is to show a time series chart that compares the last n weeks this year to the last n weeks last year. A slicer determines the number of weeks. The time series chart should be dynamic in that if the selection is 13 weeks, only the last 13 weeks this year and the same period last year are displayed on the chart. I've been struggling with how to set this up. I can chart weekly data, but not year over year and not linked to the slicer. Thanks for your help.
4 Replies
- amitchandak
Super User
MidtownMo , week year is 365 days behind(same week last year if week is selected)
week Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-364,DAY))
other options you can check here
- MidtownMo
Helper I
Thanks for the quick reply. This helps to determine one value: the same week last year. The next challenge is to determine how to chart the current n weeks and the same n weeks a year ago. Any ideas?
- v-easonf-msft
Community Support
Hi, MidtownMo
I think the methods in the links below will give you some ideas.
https://community.powerbi.com/t5/Desktop/Year-over-Year-in-line-chart/m-p/13691
https://www.youtube.com/watch?v=95rfK8-KMwA
Best Regards,
Community Support Team _ Eason- MidtownMo
Helper I
Thanks for the suggestions. I had seen each of those methods prior to posting the question as I didn't feel they gave me what I was looking for. For me, they come close, but ultimately not the solution I need. Thanks again.