Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Solved! Go to Solution.
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,
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.
could you please share a sample of pbix file so we can help more.
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.
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.
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?
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.