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
Anonymous
Not applicable

Calculating total sales of current year and previous year

Hello Everyone,

 

I am having difficulty in making a measure to calculate difference between current year formula with the last year. Assuming the data below:

 

Date                      Name                 Sales

01/02/2015           AAA                    250

02/11/2016            BBB                    500

15/3/2017               CCC                   125

14/12/2018           DDD                    300

15/01/2019            EEE                       2

17/09/2020             FFF                    100

02/05/2021            GGG                   174

 

I have sales of different year , I want to make a dynamic measure for calculating the difference between the total sales of current year and the previous year. I have figured out to get the total sales of current year by using today and year function , but i am having diffciulty of getting the total sales of the previous year. My goal is that when we move in the next year i.e 2022,  values change accordingly taking the total sales of 2022 and subtracting it from 2021.  Please anyone help me on this.

 

Thank You,

 

1 ACCEPTED SOLUTION

Hi,

Thank you for your feedback.

There are many ways to create a calendar table, and calendarauto is also useful function.

In my case, I prefer to create a calendar table in Power Query Editor. The reason is that it is easy for me to create additional columns like, year / month / monthname / week of year / week of month / weeknumber / weekname / and so forth / columns .

 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

3 REPLIES 3
Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

Please check the below picture and the sample pbix file's link down below, whether it is what you are looking for.

All measures are in the sample pbix file.

Picture7.png

 

https://www.dropbox.com/s/2arv1qn2t5iiu17/hamzakhan.pbix?dl=0 

 

 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Anonymous
Not applicable

Hello Jihwan, 

 

Can you please tell me how you made the dates table? Is it auto calendar formula that you used?

Hi,

Thank you for your feedback.

There are many ways to create a calendar table, and calendarauto is also useful function.

In my case, I prefer to create a calendar table in Power Query Editor. The reason is that it is easy for me to create additional columns like, year / month / monthname / week of year / week of month / weeknumber / weekname / and so forth / columns .

 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


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.