Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Event State Cycle Count
Start 1
Charge 1
Discharge 1
Charge 2
Discharge 2
End 2
Thanks Vijay, You've definitely moved the ball. The only thing is that were counting the number of charge and discharge (or discharge and charge) cycles. The first combination is cycle 1 the next is 2, the next is 3 and so forth. We assign the start and end state to 1 and the last cycle counted respectively. If there are other states beyond charge or discharge they would be assigned to the cycle previously counted. So in your case the second discharge would still be 2 and the Dummy State would also be 2. The End would also be 2. In this example since charge is the first after start that would be the trigger state to increment the cycle count. If discharge was first after start it would be the trigger state.
See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test
I don't know the logic for value 2 for End. I assumed that it is the maximum in that column.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCi5JLCpRitWJVnLOSCxKTwUzXTKLkxE8nBJovNLc3EqF4pLEEgjfNS9FKTYWAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Event State" = _t]),
#"Added Index" = Table.AddIndexColumn(Source, "Index", 1, 1, Int64.Type),
BuffList = List.Buffer(#"Added Index"[Event State]),
#"Added Custom" = Table.AddColumn(#"Added Index", "Count", each List.Count(List.Select(List.FirstN(BuffList,[Index]), (x)=> x=[Event State]))),
Maximum = List.Max(#"Added Custom"[Count]),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Cycle Count", each if [Event State]="End" then Maximum else [Count]),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom1",{"Index", "Count"})
in
#"Removed Columns"
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 10 | |
| 9 | |
| 6 | |
| 5 | |
| 3 |