Forum Discussion
running total showing wrong Total
Hi Team,
I have a measure as below to calculate the running total of IDs. however I see a strange wrong total issue as highlighted below. Please help me what resolve this issue.
For 04/09/2022 to 04/12/2022 it should show 17220 as Running total instead of 17219.
Measure :
Running Total=
var maxdate = Max('data'[DATE])
return CALCULATE(COUNT('data'[ID]),ALL('data'[DATE]),'data'[status]="Completed",'data'[DATE] <= maxdate)
- Anonymous2 years ago
Hi LP280388 ,
I did simple samples as it might be a bit difficult to write more than 10,000 data so I used sum instead of count and you can check the result as below:
Running Total = var _t = ADDCOLUMNS('Table',"Total",SUMX(FILTER(ALL('Table'),[DATE]<=EARLIER([DATE])&&[status]="Completed"),'Table'[ID])) return SUMX(_t,[Total])You can simply change it to suit your needs.
An attachment for your reference. Hope it helps!
Best regards,
Community Support Team_ Scott ChangIf this post helps then please consider Accept it as the solution to help the other members find it more quickly.
7 Replies
- AmiraBedhSuper User
Can you try the following :
Running Total = VAR maxdate = MAX('data'[DATE]) RETURN CALCULATE( COUNT('data'[ID]), FILTER( ALL('data'), 'data'[DATE] <= maxdate && 'data'[status] = "Completed" ) )I used FILTER(ALL('data'), ...) instead of ALL('data'[DATE])to ensure that all filters are removed from the entire data table but keeps the logic that checks the date and status.