something like this?

(*with your example*)

**Name** |
**Values** |
**CntGrp** |
**CountOver** |

A.N.Other01 |
13 |
1 |
0 |

A.N.Other01 |
23 |
1 |
1 |

A.N.Other01 |
100 |
1 |
2 |

A.N.Other01 |
122 |
1 |
3 |

A.N.Other01 |
156 |
1 |
4 |

A.N.Other01 |
347 |
1 |
5 |

A.N.Other01 |
2135 |
1 |
6 |

A.N.Other02 |
45 |
2 |
0 |

A.N.Other02 |
124 |
2 |
1 |

A.N.Other02 |
783 |
2 |
2 |

A.N.Other02 |
2345 |
2 |
3 |

A.N.Other03 |
5 |
3 |
0 |

A.N.Other04 |
35 |
4 |
0 |

A.N.Other05 |
67 |
5 |
0 |

A.N.Other06 |
23 |
6 |
0 |

A.N.Other06 |
23 |
6 |
1 |

A.N.Other06 |
32 |
6 |
2 |

A.N.Other06 |
58 |
6 |
3 |

A.N.Other06 |
67 |
6 |
4 |

function: fnRunningTotCountOver

Code:

(MyTable as table) as table =>
let
Source = Table.Buffer(MyTable),
TableType = Value.Type(Table.AddColumn(Source, "RunningTotCountOver", each null, type number)),
Cumulative = List.Skip(List.Accumulate(Source[Count],{0},(Cumulative,Count) => Cumulative & {List.Last(Cumulative) + Count})),
AddedRunningTotCountOver = Table.FromColumns(Table.ToColumns(Source)&{Cumulative},TableType)
in
AddedRunningTotCountOver

table:

Code:

let
Source = Excel.CurrentWorkbook(){[Name="Table19"]}[Content],
Index = Table.AddIndexColumn(Source, "Index", 1, 1),
Grp = Table.Group(Index, {"Name", "Values", "Index"}, {{"Count", each Table.RowCount(_), type number}}),
TType = Value.Type(Table.AddColumn(Grp, "RunningTotCountOver", each null, type number)),
Grp2 = Table.Group(Grp, {"Name"}, {{"AllData", fnRunningTotCountOver, TType}}),
ExpAllData = Table.ExpandTableColumn(Grp2, "AllData", {"Values", "RunningTotCountOver"}, {"Values", "RunningTotCountOver"}),
Extract = Table.AddColumn(ExpAllData, "Last Characters", each Text.End([Name], 1), type text),
Reorder = Table.ReorderColumns(Extract,{"Name", "Values", "Last Characters", "RunningTotCountOver"}),
Ren = Table.RenameColumns(Reorder,{{"Last Characters", "CntGrp"}}),
Subtract = Table.TransformColumns(Ren, {{"RunningTotCountOver", each _ - 1, type number}}),
Rename = Table.RenameColumns(Subtract,{{"RunningTotCountOver", "CountOver"}})
in
Rename

## Like this thread? Share it with others