Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

View all the Fabric Data Days sessions on demand. View schedule

Reply
CornelisV
Helper IV
Helper IV

Cumulative sum from different categories in same plot/table

Dear all,

 

we are struggling for finding the best method to apply cumulative sum from two different categories and putting into the same table and plot.

As Main source, here is the table:

source.png

the table is split into two different category: 2025 and 2024.

The desired answer is:

answer.png

Column Day has been created using this DAX in the Calendar table:

Days = FORMAT(DATE(YEAR('Calendar'[Datum]),12,31) - DATE(YEAR('Calendar'[Datum]),1,1), "General Number") -
            FORMAT(DATE(YEAR('Calendar'[Datum]),12,31) - 'Calendar'[Date], "General Number") +1
 Calendar.png  
This Calendar table is linked with the Main source table (see above) and I tried to apply cumulative sum using this Measure:
**bleep** sum =
  CALCULATE(
     SUM('Source'[Score]),
     'Calendar'[Date] <= MAX('Calendar'[Date])
  )
 
No result.png
 
As you may see, the cumulative sum is not properly calculated over number of days. 
Could you please demonstrate how to solve this?
 
Here is the excel file data:
dateScore
01-01-20255
01-01-20258
02-01-20254
03-01-20253
04-01-20255
04-01-20256
05-01-20254
02-01-20244
02-01-20248
02-01-20241
03-01-20241
04-01-20248
05-01-20243

 

Best regards,

 

Cornelis

 

 

1 ACCEPTED SOLUTION
Sachin001
Frequent Visitor

@CornelisV Find steps below: 

 

Created a  table using your data:

Sachin001_1-1745477986222.png

 

for year 2024 cumulative sum will start as 13 not 19 as 8+1+4 = 13

 

 

 

1. Create new column as a Year and Day. 

2. Create cummulative Column with below dax code:

 

Column Running Total =

 CALCULATE(
      Sum('Table (4)'[Score]),
        'Table (4)'[Date] <= EARLIER('Table (4)'[Date]),
        'Table (4)'[Year] = EARLIER('Table (4)'[Year]),
        ALL('Table (4)')
        )
 
 
 
Result :  
Sachin001_0-1745477940966.png

 

let me know if this helps

 

 

View solution in original post

6 REPLIES 6
Sachin001
Frequent Visitor

@CornelisV Find steps below: 

 

Created a  table using your data:

Sachin001_1-1745477986222.png

 

for year 2024 cumulative sum will start as 13 not 19 as 8+1+4 = 13

 

 

 

1. Create new column as a Year and Day. 

2. Create cummulative Column with below dax code:

 

Column Running Total =

 CALCULATE(
      Sum('Table (4)'[Score]),
        'Table (4)'[Date] <= EARLIER('Table (4)'[Date]),
        'Table (4)'[Year] = EARLIER('Table (4)'[Year]),
        ALL('Table (4)')
        )
 
 
 
Result :  
Sachin001_0-1745477940966.png

 

let me know if this helps

 

 

Hi @Sachin001 , thank you for your solution. That is is exact what I'm looking for. I used the Measure option, but you have applied the cumulative sum directly in the table (4). That is a different approach but it works.

Have a great day,

Cornelis

mh2587
Super User
Super User

Cumulative Score = // Try this one might help you
VAR SelectedYear = SELECTEDVALUE('Calendar'[Year])
VAR CurrentDay = MAX('Calendar'[DayOfYear])
RETURN
CALCULATE(
    SUM('Source'[Score]),
    FILTER(
        ALL('Calendar'),
        'Calendar'[Year] = SelectedYear &&
        'Calendar'[DayOfYear] <= CurrentDay
    )
)

Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



Dear @mh2587 , thank you for your prompt answer.

The DayOf Year, could you please clarify?

Error.png

 

Best regards,

 

Cornelis

 

If you don't have DayOfYear Column you can create like following:

DayOfYear = DATEDIFF(STARTOFYEAR('Calendar'[Date]), 'Calendar'[Date], DAY) + 1

Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



Hello @mh2587 , thank you!

I have just applied in Power BI and here is the result:

No result.png

As you can see, no cumulative calculation. The score 1-2-2025 must be 13, at 02-01-2025 17, at 03-01-2025 20. Something goes wrong.

Any idea?

 

Best regards,

 

Cornelis

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors