cancel
Showing results for
Did you mean:
Highlighted
New Member

## Looking for a PowerBI Dax solution - rolling cumulative transaction based, not time

Hey looking for a way to sum a column by limiting the sum (of Flags) to the current and previous 3 rows.  These events have date time stamps, but the time delta between the transactions is not exact to do a rolling cumulative by a datesbetwen function.  And specifically we only want the past 4 transactions to be counted.

DTS   Value   Flag   RollingFlagCount

12:21  5.5         1               1

12:22  6.0         0               1

12:30  6.2         1               2

12:33  6.3         1               3

12:35  3            0               2

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team

## Re: Looking for a PowerBI Dax solution - rolling cumulative transaction based, not time

Hi @dacoil,

You can use below formula to get the grouping rolling count.

Sample measure:

`RollingCount = COUNTX(FILTER(ALL(test),[DTS]<=MAX(test[DTS])&&[Flag]=MAX(test[Flag])),[Flag])`

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

For learning resources/Release notes, please visit: | |
Community Support Team

## Re: Looking for a PowerBI Dax solution - rolling cumulative transaction based, not time

Hi @dacoil,

You can use below formula to get the grouping rolling count.

Sample measure:

`RollingCount = COUNTX(FILTER(ALL(test),[DTS]<=MAX(test[DTS])&&[Flag]=MAX(test[Flag])),[Flag])`

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

For learning resources/Release notes, please visit: | |