Forum Discussion
CornelisV
1 year agoHelper 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: ...
- 1 year ago
CornelisV Find steps below:
Created a table using your data:
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 :let me know if this helps
mh2587
1 year agoSuper 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
)
)
- CornelisV1 year agoHelper IV
Dear mh2587 , thank you for your prompt answer.
The DayOf Year, could you please clarify?
Best regards,
Cornelis
- mh25871 year agoSuper User
If you don't have DayOfYear Column you can create like following:
DayOfYear = DATEDIFF(STARTOFYEAR('Calendar'[Date]), 'Calendar'[Date], DAY) + 1