Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
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 )
)
User | Count |
---|---|
48 | |
44 | |
19 | |
14 | |
14 |
User | Count |
---|---|
107 | |
57 | |
29 | |
20 | |
16 |