Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello my PBI friends
Odd question, here. I have table that includes the following data, sorting State+County in ascending order:
| State | County | State+County | Index |
| Arkansas | Bradley | Arkansas Bradley | 1 |
| Arkansas | Calhoun | Arkansas Calhoun | 2 |
| Arkansas | Chicot | Arkansas Chicot | 3 |
| Arkansas | Clark | Arkansas Clark | 4 |
| Arkansas | Clay | Arkansas Clay | 5 |
| Arkansas | Craighead | Arkansas Craighead | 6 |
| Arkansas | Cross | Arkansas Cross | 7 |
| Arkansas | Desha | Arkansas Desha | 8 |
| Arkansas | Greene | Arkansas Greene | 9 |
| Arkansas | Hempstead | Arkansas Hempstead | 10 |
| Arkansas | Izard | Arkansas Izard | 11 |
| Arkansas | Jefferson | Arkansas Jefferson | 12 |
| Arkansas | Lee | Arkansas Lee | 13 |
| Arkansas | Lincoln | Arkansas Lincoln | 14 |
| Arkansas | Miller | Arkansas Miller | 15 |
I want to add a new "Group" column and group them so that the first five (Index 1 - 5) are group "1", second five (Index 6 - 10) are group "2" and so forth, like this:
| State | County | State+County | Index | Group |
| Arkansas | Bradley | Arkansas Bradley | 1 | 1 |
| Arkansas | Calhoun | Arkansas Calhoun | 2 | 1 |
| Arkansas | Chicot | Arkansas Chicot | 3 | 1 |
| Arkansas | Clark | Arkansas Clark | 4 | 1 |
| Arkansas | Clay | Arkansas Clay | 5 | 1 |
| Arkansas | Craighead | Arkansas Craighead | 6 | 2 |
| Arkansas | Cross | Arkansas Cross | 7 | 2 |
| Arkansas | Desha | Arkansas Desha | 8 | 2 |
| Arkansas | Greene | Arkansas Greene | 9 | 2 |
| Arkansas | Hempstead | Arkansas Hempstead | 10 | 2 |
| Arkansas | Izard | Arkansas Izard | 11 | 3 |
| Arkansas | Jefferson | Arkansas Jefferson | 12 | 3 |
| Arkansas | Lee | Arkansas Lee | 13 | 3 |
| Arkansas | Lincoln | Arkansas Lincoln | 14 | 3 |
| Arkansas | Miller | Arkansas Miller | 15 | 3 |
I tried a few different things but I could not figure out how to get it the way I need it.
Any ideas?
Thank you!!
Solved! Go to Solution.
@Anonymous
Create a blank Query, go to the Advanced Editor, clear the existing code, and paste the codes give below and follow the steps.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bdHJDsIgEIDhVzFc9SDuHrUmLtGTx8bDxE6FiGAAE/XprQsti7fO3w9CMnlO9hYskg7J1E3aR/XxCe16XMsC7+TQyclMn0EaMFWcaygEvn+72GoSjXUGglXX+bpJvUQzflQ2wK70EytAnwP6C4M/8hHB9zxMnAZ+YghFgL04Sk8oY0L9DeNYLtAw8KULk1guNaJEn9ZlGtsVXq7GRi/2I+3GR9ZP0AF3gSa722BZojYq2J4fabLALQYv/4402d2Wy6MSwb1NoskCd1wI1L6uC622eHgB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"(blank)" = _t, #"(blank).1" = _t, #"(blank).2" = _t, #"(blank).3" = _t]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Index", Int64.Type}}),
#"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index.1", 0, 1, Int64.Type),
#"Integer-Divided Column" = Table.TransformColumns(#"Added Index", {{"Index.1", each Number.IntegerDivide(_, 5), Int64.Type}}),
#"Added to Column" = Table.TransformColumns(#"Integer-Divided Column", {{"Index.1", each _ + 1, type number}})
in
#"Added to Column"
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
@Anonymous
Create a blank Query, go to the Advanced Editor, clear the existing code, and paste the codes give below and follow the steps.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bdHJDsIgEIDhVzFc9SDuHrUmLtGTx8bDxE6FiGAAE/XprQsti7fO3w9CMnlO9hYskg7J1E3aR/XxCe16XMsC7+TQyclMn0EaMFWcaygEvn+72GoSjXUGglXX+bpJvUQzflQ2wK70EytAnwP6C4M/8hHB9zxMnAZ+YghFgL04Sk8oY0L9DeNYLtAw8KULk1guNaJEn9ZlGtsVXq7GRi/2I+3GR9ZP0AF3gSa722BZojYq2J4fabLALQYv/4402d2Wy6MSwb1NoskCd1wI1L6uC622eHgB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"(blank)" = _t, #"(blank).1" = _t, #"(blank).2" = _t, #"(blank).3" = _t]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Index", Int64.Type}}),
#"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index.1", 0, 1, Int64.Type),
#"Integer-Divided Column" = Table.TransformColumns(#"Added Index", {{"Index.1", each Number.IntegerDivide(_, 5), Int64.Type}}),
#"Added to Column" = Table.TransformColumns(#"Integer-Divided Column", {{"Index.1", each _ + 1, type number}})
in
#"Added to Column"
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
@Fowmy Excellent, I added the Integer-Divided Column and Added to Column steps and it worked perfectly! Thank you!!
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.