Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
RAdams
Helper III
Helper III

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
kcantor
Community Champion
Community Champion

@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.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

4 REPLIES 4
CheenuSing
Community Champion
Community Champion

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!

@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

kcantor
Community Champion
Community Champion

@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.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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

R

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

Check out the October 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

Find out what's new and trending in the Fabric Community.