Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
kovacikm78
Frequent Visitor

Calculation based on Max Date in Date Slicer while ignoring Min Date

Hello,
could you please help me with this measure, where I want calcutate sales for last 90 days while keeping
max date from the filter while ignoring min. date of the slicer.
The solution should also partly ignore the x axis with months. Let me explain: if I have a chart with months
eg. Nov2022, the result should be sum of all sales from Sep-01 to Nov30 (90 days).
I tryied all, removefilter... nothing helped.
This is the measure I would like to be reviewd:
CA
LCULATE([SalesSum_measure],Calendar[Date]>MAX(Calendar[Date])-90)
I am new with dax, so your help would be appreciated.
2 ACCEPTED SOLUTIONS
ahmadibrahimbus
Resolver III
Resolver III

Dear @kovacikm78 ,

if I understand you correctly please use the below meausre:

Revenue PY =
CALCULATE(
SUM(Sales[Sales Amount]),
DATESINPERIOD(
'Date'[Date],
MAX('Date'[Date]),
-3,
MONTH
)
)

please refer to the DATESINPERIOD function in the below link:

DATESINPERIOD function (DAX) - DAX | Microsoft Learn

please markup this as an accepted solution if it works.

Best Regards,

View solution in original post

Ashish_Mathur
Super User
Super User

Hi,

Try this measure

=CALCULATE([SalesSum_measure],DATESBETWEEN(Calendar[Date],EDATE(MIN(Calendar[Date]),-2),MAX(Calendar[Date])))

To your x-axis, ensure that you drag Year and Month name from the Calendar Table.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

6 REPLIES 6
ahmadibrahimbus
Resolver III
Resolver III

could you please share a sample of pbix file so we can help more.

Ashish_Mathur
Super User
Super User

Hi,

Try this measure

=CALCULATE([SalesSum_measure],DATESBETWEEN(Calendar[Date],EDATE(MIN(Calendar[Date]),-2),MAX(Calendar[Date])))

To your x-axis, ensure that you drag Year and Month name from the Calendar Table.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hello,
thank you very much for you help. The calculeation works fine ony if I dont use timeline. Once I add months in a table or chart, the result is computed only for specific month and not for the whole period.
It should work even for days. So if I have in table specific day, it should return sum of  sales for previous two months. Now it returs only one day. Or one month, if I choose months view...
Is there a way it can be calculated that way?

You are welcome.  I am very confused about your requirement.  


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
ahmadibrahimbus
Resolver III
Resolver III

Dear @kovacikm78 ,

if I understand you correctly please use the below meausre:

Revenue PY =
CALCULATE(
SUM(Sales[Sales Amount]),
DATESINPERIOD(
'Date'[Date],
MAX('Date'[Date]),
-3,
MONTH
)
)

please refer to the DATESINPERIOD function in the below link:

DATESINPERIOD function (DAX) - DAX | Microsoft Learn

please markup this as an accepted solution if it works.

Best Regards,

Hello,
thank you very much for you help. The calculeation works fine ony if I dont use timeline. Once I add months in a table or chart, the result is computed only for specific month and not for the whole period (3 months back).
It should work even for days. So if I have in table specific day, it should return sum of  sales for previous three months. Now it returs only one day. Or one month, if I choose months view...
Is there a way it can be calculated that way?

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.