cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RAdams Regular Visitor
Regular Visitor

Compare YTD to PYTD Sales by Week Numbers

Hello All!!!

 

I've looked around a bit and haven't had much luck finding help on this. 

 

I have 2016 and 2017 Sales Data. I have InvoiceDate and Sales as my main columns. I'd like to be able to compare say Weekend Ending 3-25-17 to the comprabable Week Ending in 2016, which is 3-26-16. I am able to figure out how to get Week Number but I haven't been able to figure out a good way to use SamePeriodLastYear by week number. Or can I even use that?!?! 

 

Any suggestions/help/advice would be greatlly appreciated!

 

Thanks!

R

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Compare YTD to PYTD Sales by Week Numbers

@RAdams

Build your calculations for this year and for last year. Then create a growth calculation: This year - Last Year.

After you create the totals it is a simple matter to put week numbers on rows or on the axis.

Total Sales = SUM(Sales[Line Sales])

Last Year Sales = CALCULATE([Total Sales], DATEADD(Date[Datekey], -1, year))

Growth = [Total Sales]-[Last Year Sales]

Make sure your report/page is filtered to the current year for the last year calculation to work. Then, if you would like, you can use your weeknumber as a filter as well. For example this week I would set my week number filter to be less than 15.

4 REPLIES 4
Super User
Super User

Re: Compare YTD to PYTD Sales by Week Numbers

Hi @RAdams

 

Please check out the link

 

https://www.sqlbi.com/articles/week-based-time-intelligence-in-dax/

 

If it works for you please accept this as a solution and also give KUDOS.

 

Cheers

 

CheenuSing

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!
RAdams Regular Visitor
Regular Visitor

Re: Compare YTD to PYTD Sales by Week Numbers

@CheenuSing Thanks for taking the time to share the link. I looked through a couple times and I'm still a bit confused. 

 

Should I use filters to compare Previous and Current Years? If so, how do I use Week Numbers in the filters? 

 

Thanks again for your time. 

 

R

Highlighted
Super User
Super User

Re: Compare YTD to PYTD Sales by Week Numbers

@RAdams

Build your calculations for this year and for last year. Then create a growth calculation: This year - Last Year.

After you create the totals it is a simple matter to put week numbers on rows or on the axis.

Total Sales = SUM(Sales[Line Sales])

Last Year Sales = CALCULATE([Total Sales], DATEADD(Date[Datekey], -1, year))

Growth = [Total Sales]-[Last Year Sales]

Make sure your report/page is filtered to the current year for the last year calculation to work. Then, if you would like, you can use your weeknumber as a filter as well. For example this week I would set my week number filter to be less than 15.

RAdams Regular Visitor
Regular Visitor

Re: Compare YTD to PYTD Sales by Week Numbers

Awesome. A simple explanation is all I needed! I was way over complicating it! 

R