Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Hi
I Power Query, how do I number each row of data, so each group is the same number, but I only want the numbering to go upto 5 then start again?
Cheers
pls try this code
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WqqqqUorVwaQdnZzBtKtnMArt7OiCQoe4QtR5OTphpT0cwZRvgD8KHRmETHn6OAKVxQIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Group = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Group", type text}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Group"}, {{"Count", each _, type table [Group=nullable text]}}),
#"Added Index" = Table.AddIndexColumn(#"Grouped Rows", "Index", 1, 1, Int64.Type),
#"Calculated Modulo" = Table.TransformColumns(#"Added Index", {{"Index", each if Number.Mod(_, 5)=0 then 5 else Number.Mod(_, 5) , type number}}),
#"Removed Columns" = Table.RemoveColumns(#"Calculated Modulo",{"Group"}),
#"Expanded Count" = Table.ExpandTableColumn(#"Removed Columns", "Count", {"Group"}, {"Group"})
in
#"Expanded Count"
Use GroupKind.Local and Modulus.
If you like more help please provide the sample data in a usable format, not as a screenshot.
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 45 | |
| 38 | |
| 34 | |
| 21 | |
| 17 |
| User | Count |
|---|---|
| 65 | |
| 62 | |
| 31 | |
| 26 | |
| 25 |