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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
ThornTech
Frequent Visitor

Running count that resets

Hi,

 

I have a data set where I want to count the number of Loss or wins in a row, but reset each time it switches to the new name like this:

Win

1
Win2
Win3
Loss1
Loss2
Win1
Win2

 

The Trade UID is the main index for this table that is unique.

ThornTech_0-1633879039537.png

 

Any guidance on how to do this would be great, I've tried quite a few different things and the closest I can get it to create a running count, but can't get it to reset.

 

A sample of the dataset can be found here: https://1drv.ms/u/s!Ag_sNauqdCgpg95oGmGBlk9NJrf0Uw?e=hICHI1 

 

Thanks

1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

Screenshot 2021-10-10 195951.png

 

PQ and Excel formula are way much conciser and more straightforward,

Grouped = Table.RemoveColumns(Table.Group(Source, "PnL Text", {"ar", each Table.AddIndexColumn(_, "Streak_PQ", 1)}, 0), "PnL Text")

Screenshot 2021-10-10 200134.png

 

Screenshot 2021-10-10 200529.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

2 REPLIES 2
ThornTech
Frequent Visitor

This worked a treat, I used the PQ version in the end. Thanks for quick help.

CNENFRNL
Community Champion
Community Champion

Screenshot 2021-10-10 195951.png

 

PQ and Excel formula are way much conciser and more straightforward,

Grouped = Table.RemoveColumns(Table.Group(Source, "PnL Text", {"ar", each Table.AddIndexColumn(_, "Streak_PQ", 1)}, 0), "PnL Text")

Screenshot 2021-10-10 200134.png

 

Screenshot 2021-10-10 200529.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors