Calculate the Sum of Sales Between Two Dates using New Measure | Deep Dive Into PowerBi
The previous article of this series was about How to show the count of items on Slicer. If you want to read the previous article click on the
In this article, we will learn how to find gross sales between two dates using the DAX function. This article is really helpful for you guys because you have to use this function many times in your career.
Let's start
Guys, we have data of grocery stores that have information about sales with date, item type and mode of sale, etc. I show you the help of the picture.
Now it's time to create new measures. Firstly we look at how to create new measures.
Click on ribbon's Home then click on the new measure
Home -> new measure (shown in picture)
After clicking on the new measure, the measure is declared you have to write DAX function here. (Shown in picture)
Dax Function is written in the above measure
CalSaleDate = CALCULATE(SUM(SalesRecordsDb[Units_Sold]), DATESBETWEEN(SalesRecordsDb[Order_Date],
DATE(2016,02,1),
DATE(2016,04,30)
))
Execute your DAX function, measure successfully is created with the name 'CalSaleDate'.
Plot your measure on Table and Card visuals in PowerBI
Now you achieved your requirement. The final dashboard is ready (your dashboard is ready to fulfill your requirement )