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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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