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!Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.
Hello PowerBi Community,
I would like to calculate the rolling 5 years sum of sales while excluding year 3.
Hence, the sum of years 1+2 and years 4+5.
Is there a way to calculate this using only one calculate function?
Currently I have tried to use the following code:
VAR LastDateToUse = MAX ( 'CALENDAR'[Date] )
Another "creative" way would be to calculate the last five years and then subtract the value for year 3.
Using CALCULATE and aggregation functions in the same formula is a mild red flag. Usually you use one or the other, not both.
CALCULATE ( SUM (Sales_ProductSerial[Unit Wholesale] ),
CALENDAR[Date] IN CALENDAR(EDATE(LastDateToUse,-60)+1,LastDateToUse)
CALENDAR[Date] NOT IN CALENDAR(EDATE(LastDateToUse,-36)+1,EDATE(LastDateToUse,-24))
)
Thank you for taking a look.
I have rewritten your suggestion a little bit:
It is resulting in the following error: "the start date or end date in Calendar function can not be a blank value". Any idea what is causing that?
Further, there are is another requirements that I did not mention before, but does limit the options for solving this. I multiple the unit wholesale by a value of the related parts table in the sumx.
For year 3 I am using another related value than for the 1+2+4+5 years, which is why I need to break them up. I have solved it using the below code which looks very inefficient.
Hi,@Nicole_E
May I ask if your problem has been solved, I see that you have found a suitable solution yourself, if your problem has been solved, please mark the suggestions you have provided as solutions.
I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Carson Jian,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the September 2025 Power BI update to learn about new features.
User | Count |
---|---|
9 | |
8 | |
6 | |
4 | |
3 |