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!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
First of all, my English is a little weak. I am sorry. I want to calculate cumulative sales by weeks. But it has to be calculated separately according to 2022 and 2023 years. In addition, the product year should be calculated separately for products with "22 SS" and "23 SS". There are no "23 SS" products for 2022. But in 2023 there are "22 SS" products. For example, I just want to compare sales of "22SS" in 2022 with sales of "23SS" in 2023. "22 SS" sales should not come in 2023. I'm waiting for your help. The Dax formula I wrote earlier is as follows.
Cumulative Sales =
var _season = MAX(Merch[Season[Season Group Name]]])
var _weekMax = MAX(Merch[Calendar[Merch Year Week]]])
var _weekMin = MAX(Merch[Calendar[Merch Year Week]]])
var _year = MAX(Merch[Calendar[Merch Year]]])
var _Country = MAX(Merch[Store[Country Name]]])
var _Brand = MAX(Merch[Product[BrandName]]])
var _Div = MAX(Merch[Product[Division Name]]])
var _DivD = MAX(Merch[Product[DivisionDName]]])
return
CALCULATE(
SUM(Merch[[Net Sales Quantity]]]),
FILTER(ALL(Merch),
Merch[Season[Season Group Name]]]="22 SS" && Merch[Calendar[Merch Year Week]]]<=_weekMin && Merch[Calendar[Merch Year]]]=_year && Merch[Store[Country Name]]]=_Country && Merch[Product[BrandName]]] = _Brand && Merch[Product[Division Name]]] =_Div && Merch[Product[DivisionDName]]] = _DivD ||
Merch[Season[Season Group Name]]]="23 SS" && Merch[Calendar[Merch Year Week]]]<=_weekMin && Merch[Calendar[Merch Year]]]=_year && Merch[Store[Country Name]]]=_Country && Merch[Product[BrandName]]] = _Brand && Merch[Product[Division Name]]] =_Div && Merch[Product[DivisionDName]]] = _DivD ||
Merch[Season[Season Group Name]]]="22 AW" && Merch[Calendar[Merch Year Week]]]<=_weekMin && Merch[Calendar[Merch Year]]]=_year && Merch[Store[Country Name]]]=_Country && Merch[Product[BrandName]]] = _Brand && Merch[Product[Division Name]]] =_Div && Merch[Product[DivisionDName]]] = _DivD ||
Merch[Season[Season Group Name]]]="23 AW" && Merch[Calendar[Merch Year Week]]]<=_weekMin && Merch[Calendar[Merch Year]]]=_year && Merch[Store[Country Name]]]=_Country && Merch[Product[BrandName]]] = _Brand && Merch[Product[Division Name]]] =_Div && Merch[Product[DivisionDName]]] = _DivD
)
)
Seems like there is a calender table, there is also date. So the usage of YTD function should do the desired work.
Refer to this:
YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Calendar'[Date],"12/31"))
You can also explore
Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA
Power BI Window function Rolling, Cumulative/Running Total, WTD, MTD, QTD, YTD, FYTD: https://youtu.be/nxc_IWl-tTc
https://medium.com/@amitchandak/power-bi-window-function-3d98a5b0e07f