How To Calculate Previous Month Sales In Power Bi

To calculate the previous month’s sales in Power BI, you can follow these steps:

  1. Create a new measure using the DAX language. Let’s name it “Previous Month Sales”.
  2. Use the CALCULATE function to perform the calculations based on your data model.

Here’s an example of how you can implement this:


  Previous Month Sales = 
  CALCULATE(
    SUM(Sales[Amount]), -- Replace "Sales[Amount]" with the actual column name of your sales amount
    DATESMTD(DATEADD(Dates[Date], -1, MONTH)) -- Replace "Dates[Date]" with the actual column name of your date column
  )
  

In this example, we are using the SUM function to calculate the total sales amount. Adjust the column name inside the SUM function as per your data model.

The DATESMTD function is used to calculate the sales within the month-to-date period. We are passing the DATEADD function as its argument to go back to the previous month. Adjust the column name inside the DATEADD function with your actual date column.

By creating and using this measure, you will get the previous month’s sales in Power BI. You can then use it in visualizations or as a filtering condition in other calculations.

Leave a comment