How to calculate last 3 months sales with Dax in power bi?

To calculate last 3 months sales in Power BI using DAX (Data Analysis Expressions), you can follow these steps:

  1. Ensure that you have a date column in your dataset. Let’s assume the column name is “Date.”
  2. Create a new measure to calculate the total sales for the last 3 months. You can use the following DAX formula:
Last 3 Month Sales = CALCULATE(SUM(SalesTable[Sales]), DATESINPERIOD('SalesTable'[Date], LASTDATE('SalesTable'[Date]), -3, MONTH))

This formula uses the CALCULATE function to calculate the sum of sales for the specified period. The DATESINPERIOD function is used to define the period, starting from the last date in the dataset and going back 3 months.

  1. Replace “SalesTable” with the actual name of your sales table in the formula.
  2. Save the measure and use it in your Power BI report or visualization to display the last 3-month sales.

By applying this measure, you will get the sum of sales for the most recent calculate last 3 months sales based on the date column in your dataset.

Leave a Comment