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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
aadusumilli
Frequent Visitor

DAX Formula Rolling Sum when Flag is 1, however, Sum should set to 0 if continuity fails.

DateFlag Needed Column Comments
Wednesday, April 1, 202000 
Thursday, April 2, 202011 
Friday, April 3, 202012increment by 1 when flg=1
Saturday, April 4, 202013 
Sunday, April 5, 202014 
Monday, April 6, 202015 
Wednesday, April 8, 202000 
Thursday, April 9, 202000 
Friday, April 10, 202011New Occurance
Saturday, April 11, 202000 
Sunday, April 12, 202011New Occurance
Monday, April 13, 202000 
Tuesday, April 14, 202011New Occurance
Wednesday, April 15, 202000 
Thursday, April 16, 202011New Occurance

 

I have tried this but I would want to reset the sum to 1 on 04/10, 04/12 and so on,

 

Part of it is achieved with formula for Sum Field Below; 

Sum = IF(Table1[Flag]=0,0,CALCULATE(SUM(Table1[Flag]),FILTER(Table1,Table1[Date] <= EARLIER(table1[Date]))))

 

DateFlagSum
Wednesday, April 1, 202000
Thursday, April 2, 202011
Friday, April 3, 202012
Saturday, April 4, 202013
Sunday, April 5, 202014
Monday, April 6, 202015
Wednesday, April 8, 202000
Thursday, April 9, 202000
Friday, April 10, 202016
Saturday, April 11, 202000
Sunday, April 12, 202017
Monday, April 13, 202000
Tuesday, April 14, 202018
Wednesday, April 15, 202000
Thursday, April 16, 202019

 

 
1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

Seems like Cthulhu. https://community.powerbi.com/t5/Quick-Measures-Gallery/Cthulhu/td-p/509739



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

Seems like Cthulhu. https://community.powerbi.com/t5/Quick-Measures-Gallery/Cthulhu/td-p/509739



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

OMG!! this is great.

 

Thanks for the quick response, Greg. it really helped.

 

However, i did change a litttle on Return Part; if this helps anyone

 

RETURN IF(table1[Flag] = 1,IF(ISBLANK(__max),1,IF(__max=[Index]-1,COUNTX(__tmpTable3,[Index])+1,1)),0)

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.