Forum Discussion
RenateBK
3 years agoHelper II
Need help: Cumulative sum function only returns total
Hello, Edit: Along with the solution I also identified another mistake I made. There was a mismatch between the formatting of my date table and the date column in my fact table (date/time vs dat...
- 3 years ago
Hi Renate,
Try this as a measure instead, making sure to use dDato fields in visuals, not fact table dates:
_cumulativeSum = VAR __cDate = MAX(dDato[Date]) RETURN CALCULATE( SUM(OversiktKurs[Deltagere kurs]), FILTER( ALLSELECTED(dDato), dDato[Date] <= __cDate ) )Pete
BA_Pete
3 years agoSuper User
Hi Renate,
Try this as a measure instead, making sure to use dDato fields in visuals, not fact table dates:
_cumulativeSum =
VAR __cDate = MAX(dDato[Date])
RETURN
CALCULATE(
SUM(OversiktKurs[Deltagere kurs]),
FILTER(
ALLSELECTED(dDato),
dDato[Date] <= __cDate
)
)
Pete
- RenateBK3 years agoHelper II
Hello Pete,
Thank you for the formula!
It seems I may have created a circular dependency as my Date table is created and based on the dates in my fact table;
CALENDAR(DATE(YEAR(MIN(OversiktKurs[Dato])),1,1),DATE(YEAR(MAX(OversiktKurs[Dato])),12,31)),I'm not sure if this is ok to do, but when I swap out the formula with the date column in my fact table to test it out, it returns the total sum again._cumulativeSum =VAR __cDate = MAX(OversiktKurs[Dato])RETURNCALCULATE(SUM(OversiktKurs[Deltagere kurs]),FILTER(ALLSELECTED(OversiktKurs),OversiktKurs[Dato] <= __cDate))- BA_Pete3 years agoSuper User
Hi Renate,
There's no need to swap out anything in the measure I gave you. It should work exactly as it is.
Please try the measure exactly as I wrote it and let me know how you get on.
Pete
- RenateBK3 years agoHelper II
I am receiving a circular dependency error - I fear it may be due to how I created my date table.