Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowData Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more
Hello I need to calculate the cumulative sales
On the page I have filters apllied and I just need to calculate the mesaure Sold CY but do it in a cumulative way.
First column is a month
It should be:
Jan 260
Feb 260 +339
march 260 + 339 +260 etc.
I try to do this by:
Cumulative sale =
VAR _aktualnyMiesiac = SELECTEDVALUE('TMiesiące'[Nr miesiąca]) //Current month
VAR _cumulativeSales =
CALCULATE(
SUMX('Dane sprzedaży';'Dane sprzedaży'[Workers.SprzedażTowaru.Rozchód.Ilość]); // Here sum of Sold items
FILTER(ALL('TMiesiące'[Nr miesiąca]);'TMiesiące'[Nr miesiąca]<=_aktualnyMiesiac);
FILTER('Dane sprzedaży';'Dane sprzedaży'[Workers.SprzedażTowaru.OkresOperacji.Do].[Rok]=2024)
)
RETURN _cumulativeSales
but it keeps calculating it for each month separately.
Solved! Go to Solution.
Hi, @Fistachpl
I create a sample table:
First, create a new column to show month number:
MonthNumber = MONTH('Table'[Date])
Then create a new measure and try to use the following dax:
Cumulative Sales =
CALCULATE(
SUM('Table'[Sales]),
FILTER(
ALLSELECTED('Table'),
'Table'[MonthNumber] <= MAX('Table'[MonthNumber])
)
)
Put this measure in table visual, here is my preview:
How to Get Your Question Answered Quickly
Best Regards
Yongkang Hua
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Fistachpl
I create a sample table:
First, create a new column to show month number:
MonthNumber = MONTH('Table'[Date])
Then create a new measure and try to use the following dax:
Cumulative Sales =
CALCULATE(
SUM('Table'[Sales]),
FILTER(
ALLSELECTED('Table'),
'Table'[MonthNumber] <= MAX('Table'[MonthNumber])
)
)
Put this measure in table visual, here is my preview:
How to Get Your Question Answered Quickly
Best Regards
Yongkang Hua
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Fistachpl
I don't know your model and context, but you can try below measure.
Cumulative sale =
VAR _aktualnyMiesiac = SELECTEDVALUE('TMiesiące'[Nr miesiąca]) //Current month
VAR _cumulativeSales =
CALCULATE(
SUMX('Dane sprzedaży';'Dane sprzedaży'[Workers.SprzedażTowaru.Rozchód.Ilość]); // Here sum of Sold items
FILTER(ALL('TMiesiące'[Nr miesiąca]);'TMiesiące'[Nr miesiąca]<=_aktualnyMiesiac);
FILTER(ALL('Dane sprzedaży');'Dane sprzedaży'[Workers.SprzedażTowaru.OkresOperacji.Do].[Rok]=2024);
ALL('TMiesiące')
)
RETURN _cumulativeSales
Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !
Thank you~
Just one thing. When I do:
ALL('Dane sprzedaży')
it calculates the data for more that is selected in fragmentators. Should I Keepfilters()?
Because I have fragmentators for 'Dane sprzedaży'[Kategoria], 'Dane sprzedaży'[Subkategoria] and then it counts ok. But I also have a fragmentator for the Products and if I select one it stops working.
If I add:
VAR _cumulativeSales =
CALCULATE(
SUMX('Dane sprzedaży';'Dane sprzedaży'[Workers.SprzedażTowaru.Rozchód.Ilość]);
FILTER(ALL('TMiesiące'[Nr miesiąca]);'TMiesiące'[Nr miesiąca]<=_aktualnyMiesiac);
FILTER(ALL('Dane sprzedaży');'Dane sprzedaży'[Workers.SprzedażTowaru.OkresOperacji.Do].[Rok]=YEAR(now()));
FILTER(ALL('Dane sprzedaży');'Dane sprzedaży'[Nazwa] IN VALUES('Dane sprzedaży'[Nazwa]));
)
it works - I just added filter to calculate only for selected Products (Dane sprzedaży [ Nazwa]) but it doesn't work good, at least not always. Is it good way to filter by all selected products?
wrong calculations:
Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.
Check out the May 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 |
| User | Count |
|---|---|
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 3 |