Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
dacoil
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
v-shex-msft
Community Support
Community Support

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])

Capture.PNG

 

 

Regards,

Xiaoxin Sheng

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

View solution in original post

1 REPLY 1
v-shex-msft
Community Support
Community Support

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])

Capture.PNG

 

 

Regards,

Xiaoxin Sheng

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.