I am trying to calculate the running sum of a column but I am not getting it.
Please take a look at the formula and tell me where I am going wrong.
Can you send us a pic of your data?
I assume Column1 is the date column, and Column2 has the number value?
Try to use ALLSELECTED instead of all.
Cumulative = CALCULATE(SUM('dummy'[Column2]), FILTER(ALLSELECTED(dummy),('dummy'[Column1])<=MAX('dummy'[Column1])))
You can also have a look at the TotalMTD, TotalQTD and TotalYTD DAX functions which work great for cumulative totals.
Dawid van Heerden
**If you found this reply helpful, please mark this as the answer to close the topic and make it easier to find for other people with similar questions.
Anyone know how to get cumulative total by site?
Hi sir running total measure is workong in my case but it does not show differnt value for differnet categories .
I want to show a cumulated covid cases as per district but I cant do it I tried many formula sice two day
someone help me
thanks in advance !
WHEN I USE MEASURE
|date||district||results||no of confirmed|
I used the solutions provided although I needed to reset the sum every week, this worked well for me. Added a variable for the week number to compare against. Adds each day as it goes until it reaches a new week, starts again.
Running SOP = var x = SOP[Week Number] return CALCULATE ( SUM ( 'SOP'[Production Tonnes]) , ALL (SOP), ('SOP'[Date] <= EARLIER ( 'SOP'[Date]) && weeknum(SOP[Date],2) == x))
It's a bit hacky although you could create references of the table and filter into each site (If there were not too many) Use the solution supplied to accumulative sum based on the date. Then union all of the tables... although I am sure there must be a better way...
I am ashamed I even thought of that, a much better way to sum on two columns in your situation is using Python
# 'dataset' holds the input data for this script dataset['cumsum'] = dataset.groupby(['site','datepd'])['number'].cumsum()
Pandas does not like returning dates properly, create a duplicate column which is date type datepd of your date column.
Change your original date to text so you have a reference of the date afterwards.
Use the code above.
Select the dataset.
Remove the datepd column
Change the date column to date type again.
SHould be good to go.
We're excited to announce our first cross-community 'Can You Solve These?' challenge!
Learn about the exciting things that happened in July.
Wondering what events you could join or have an event to promote yourself? Check out our Upcoming Events.
We are thrilled to announce we will begin running a monthly webinar series named Power BI Dev Camp.