Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreThe FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. 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.
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.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 50 | |
| 44 | |
| 44 | |
| 19 | |
| 19 |
| User | Count |
|---|---|
| 71 | |
| 70 | |
| 34 | |
| 33 | |
| 31 |