Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
hi all,
i'm trying to calculate the total sales for (running) last 3 months (i have already calculated the total sales for all periode "total sales")
ex; we are o december, i need the sales for november, october and septembre.
thank you for your help
Solved! Go to Solution.
This might work: put the months in the visual and put KEEPFILTERS in the formula.
total sales last 3 months =
CALCULATE (
[total sales],
KEEPFILTERS (
DATESINPERIOD ( d_date[date], EOMONTH ( MAX ( d_date[date] ), - 1 ), -3, MONTH )
)
)
thank you for you answers,
@FreemanZ i want to add a visualisation of the 3 last months (in a matrix or line chart) without filtering dates everytime when month change.
@Barthel thank you for your help,
your measure calculate the sum of the 3 months, when i put it in a matrix it doesn't show me the 3 months separately.
Yes, this measure shows the value of the three months aggregated. If you want to show the value spread over the three months you will have to work with a disconnected date table. This is a good video explaining how to create something like this.
Barthel's solution shall work, if you plot with d_date[date]. Or what error do you get?
i dont get an error with that measure, but i get the sum of the 3 months
can you make some screenshot?
This might work: put the months in the visual and put KEEPFILTERS in the formula.
total sales last 3 months =
CALCULATE (
[total sales],
KEEPFILTERS (
DATESINPERIOD ( d_date[date], EOMONTH ( MAX ( d_date[date] ), - 1 ), -3, MONTH )
)
)
that depends very much on how you are going to present it or the filter context (what columns you have in your visual, date column? month column?)
Hey @Sofinobi,
Use this formula, assuming you have a date table ('d_date') with a date column ('[date]'):
total sales last 3 months =
CALCULATE (
[total sales],
DATESINPERIOD ( d_date[date], EOMONTH ( MAX ( d_date[date] ), - 1 ), -3, MONTH )
)
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 5 | |
| 5 | |
| 4 | |
| 3 |
| User | Count |
|---|---|
| 24 | |
| 11 | |
| 11 | |
| 9 | |
| 8 |