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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
JamilESpencer
Frequent Visitor

YOY Calculation on Sale Data Across multiple periods

 

 

 

Hello Everyone,

 

I am trying to figure out how to calculate YOY. My issue is, in excel I create a pivot to summarize annual sales and on the worksheet I would calcuate the YOY using  (Previous Sales - New Sales)/Previous Sales. However, since I can't edit the visual like I do in excel, I would perform this action in the query table. Below is a snap shot of the data in my table; I need to be able to do calculate YOY at the "Product" level; assuming this will filter down to the Item Name when I create the filters in my visual

 

 

DOCDATEITEMNAMELINE AMOUNT FCProduct
2014-10-02  Chicken  20/0.5 lb$0.00Product A
2015-02-11  Chicken  20/0.5 lb$0.00Product A
2015-03-25  Chicken  20/0.5 lb$0.00Product A
2016-03-07  Chicken  20/0.5 lb$0.00Product A
2016-10-12  Chicken  20/0.5 lb$0.00Product A
2014-01-03  Chicken  4/6 lb$393.20Product A
2014-03-19  Chicken  4/6 lb$436.45Product A
2014-10-02  Chicken  4/6 lb$436.45Product A
2015-02-11  Chicken  4/6 lb$898.80Product A
2015-06-25  Chicken  4/6 lb$560.18Product A
2015-08-24  Chicken  4/6 lb$590.93Product A
2015-11-06  Chicken  4/6 lb$597.24Product A
2015-12-31  Chicken  4/6 lb$0.00Product A
2015-12-31  Chicken  4/6 lb$0.00Product A
2015-12-31  Chicken  4/6 lb$627.82Product A
2015-12-31  Chicken  4/6 lb$627.82Product A
2016-03-07  Chicken  4/6 lb$1,209.92Product A
2016-05-13  Chicken  4/6 lb$583.26Product A
2016-07-26  Chicken  4/6 lb$599.92Product A
2016-10-12  Chicken  4/6 lb$600.56Product A
2014-01-03  Chicken  3/12 lb$862.08Product A
2014-10-02  Chicken  3/12 lb$478.45Product A
2014-12-03  Chicken  3/12 lb$472.08Product A
2015-02-11  Chicken  3/12 lb$472.08Product A
2015-03-25  Chicken  3/12 lb$472.08Product A
2015-06-25  Chicken  3/12 lb$588.45Product A
2015-08-24  Chicken  3/12 lb$620.75Product A
2015-11-06  Chicken  3/12 lb$614.40Product A
2015-12-31  Chicken  3/12 lb$0.00Product A
2015-12-31  Chicken  3/12 lb$0.00Product A


 

1 ACCEPTED SOLUTION

Thanks@Interkoubess

 

This worked perfectly!

View solution in original post

2 REPLIES 2
Interkoubess
Solution Sage
Solution Sage

Hi @JamilESpencer,

 

Please add a calendar Table to your model if you don<t have one and link it to your table by date (DOCDATE).

Then create your measure as you want for example ( I called my table Data):


Sales = CALCULATE(SUM(Data[LINE AMOUNT FC])) Sales LY = CALCULATE([Sales],PREVIOUSYEAR('Calendar'[Date]))
 

and you can perform any measures you want. 

 

tests.PNG

Let us know if you have any issues.

 

Ninter

Thanks@Interkoubess

 

This worked perfectly!

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.