A for Analytics

A For Analytics
How to compare Last year and Current Year sales in Power BI?

How to compare Last year and Current Year sales in Power BI?

Introduction

Have you struggled with comparing Last Year and Current Year sales data in Power BI? Do you want to know, How to create a measure to calculate Last Year and Current Year sales data in Power BI? 

If you are a CXO and Manager, there is Surprise discount in this link  and you can know more about A for Analytics in this Introduction Video

Also, you can watch this trick in the below video

 

Technical Function

In this post, we are going to learn about How to compare last year and current year sales data in Microsoft Power BI. 

 

You can also learn about the same concept in video format as well here,

Step #1:  It’s always good to have a simple data to view the data before creating measure, use other visualizations. Similar to the picture below 

 

Step #2:  Let’s create a DAX measure for Last year sales data

Step #3:  For Visual understanding of data, we will add last year’s data to the table. Once we validate the data.

Step #4:  We need to write another DAX measure to get percentage difference between last year and current year data like

% Difference = DIVIDE( SUM(Orders[sales]),[Last Year Sales])

Step #5:  Once created the DAX Measure, we need to add it to the table or any other type of visualization.

A big Shout out to Laura GB for posting a amazing content. 

Bonus

Thanks for reading the content so far, I have a bonus for you

We have Created the DAX measure to calculate the percentage difference of Current Year and Previous Year data but in the Table, you can only see decimal which is not formatted to percentage. You need to format it to the percentage before making make it as visualization and this will work on KPI, Table, Bar chart, Line chart, or any other visualizations. 

Conclusion

A for Analytics is working super hard to provide detailed information about the problem in blog and video. We have created with solution based on our standpoint and structure of data. You may need to do some data transformation before writing the DAX Measure. 

If you think there is a better way to do this concept, please drop it in the comments section

If you have any questions about this content, please post it in the comments section

1 thought on “How to compare Last year and Current Year sales in Power BI?”

Leave a Comment

Your email address will not be published. Required fields are marked *