How to Calculate Total Sales for the Last 3 Months Dynamically in DAX

0 votes
How to Calculate Total Sales for the Last 3 Months Dynamically in DAX?
In Power BI, I need to create a DAX measure that calculates the total sales for the last three months relative to the latest available data, regardless of user slicer selections. What is the best way to construct this measure using functions like DATESINPERIOD or CALCULATE to ensure dynamic date filtering?
6 hours ago in Power BI by Evanjalin
• 16,180 points

edited 6 hours ago by Evanjalin 10 views

1 answer to this question.

0 votes

To dynamically calculate total sales for the last 3 months, ignoring user slicers, use this DAX measure:

TotalSalesLast3Months =
CALCULATE(
    SUM(Sales[OrderAmount]),
    DATESINPERIOD(
        Sales[OrderDate],
        MAX(Sales[OrderDate]),
        -3,
        MONTH
    )
)

Explanation:

  • DATESINPERIOD selects a 3-month window ending at the latest available date in the dataset.
  • CALCULATE applies this filtered period to sum the OrderAmount.
  • This measure dynamically updates based on new data but ignores slicers unless modified with ALLSELECTED().

answered 6 hours ago by anonymous
• 16,180 points

Related Questions In Power BI

0 votes
1 answer

How to calculate cumulative Total and % in DAX?

Hi, If your table is ready with percentage ...READ MORE

answered Mar 18, 2019 in Power BI by Cherukuri
• 33,030 points
19,255 views
0 votes
1 answer

How to measure in DAX to calculate YTD for chosen month only for Power BI?

If you use the date column from FactTable, ...READ MORE

answered Dec 22, 2020 in Power BI by Gitika
• 65,770 points
5,012 views
0 votes
1 answer

How to customize the report for different users in power BI?

There are different ways to achieve this. 1. ...READ MORE

answered Oct 30, 2019 in Power BI by Cherukuri
• 33,030 points
4,343 views
0 votes
1 answer

Using DAX calculation how to calculate monthly budget till today in power bi Desktop?

You can make use of this: MTD Budget ...READ MORE

answered Sep 24, 2020 in Power BI by Gitika
• 65,770 points
1,958 views
+3 votes
2 answers

Combine tables in Power BI

You can also achieve this using a ...READ MORE

answered Oct 5, 2018 in Power BI by lina
• 8,220 points

edited Oct 11, 2018 by Kalgi 2,638 views
0 votes
1 answer

Power Bi Dax Table

You need to wrap the numbers in ...READ MORE

answered Oct 5, 2018 in Power BI by Kalgi
• 52,350 points
1,258 views
0 votes
2 answers

Power BI Dax Multiple IF AND Statements

HI I have Column Patient 12 13 14 15 18 IN Patient=12, 13 Out ...READ MORE

answered May 23, 2019 in Power BI by VNK
19,141 views
0 votes
1 answer

Distinct count filtered by condition using Power BI Dax

Try this, it should work: DistinctCountActiveMonths = CALCULATE( ...READ MORE

answered Oct 5, 2018 in Power BI by Kalgi
• 52,350 points
37,849 views
0 votes
1 answer

How to Calculate Dynamic Regional Sales Percentage in DAX?

To compute the percentage of total sales ...READ MORE

answered 6 hours ago in Power BI by anonymous
• 16,180 points
15 views
0 votes
1 answer

How do I revert from using refresh policies with an EffectiveDate to using the current date in Tabular Editor 3?

To revert from using EffectiveDate to the ...READ MORE

answered 3 days ago in Power BI by anonymous
• 16,180 points
39 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP