Hi @Mo.jo.jo,
I know your question has already been solved but as an alternative you can test this query. Just copy and paste the M code below to a new blank query.
What it does is it creates a list of the Group Index for each record
and expands the content of that list to new rows.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUXL3UwBRQanpmfl5YKaRsVKsTrSSEUTSCFXS0AQsaQyRNEbTCZYzNIAaa4CQBZliZACRhtlqiCptArUWZi+SxSBrzCwg0lCbjYxRpY1MlWJjAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Group Index" = _t, #"Group Name" = _t, Region = _t, #"User ID" = _t]),
ChangeType = Table.TransformColumnTypes(Source,{{"User ID", type number}, {"Group Index", type number}, {"Group Name", type text}, {"Region", type text}}),
GroupRows = Table.Group(ChangeType, {"Region"}, {{"Table", each _, type table [Group Index=nullable number, Group Name=nullable text, Region=nullable text, User ID=nullable number]}}),
AddedCustom = Table.AddColumn(GroupRows, "Custom", each
let
myTable = [Table],
AddCustom = Table.AddColumn(myTable, "Group Index New", each myTable[Group Index]),
ExpandNew = Table.ExpandListColumn(AddCustom, "Group Index New"),
NewType = Table.TransformColumnTypes(ExpandNew,{{"Group Index New", Int64.Type}}),
CleanUpColumns = Table.RemoveColumns(NewType,{"Group Index", "Group Name"})
in
CleanUpColumns, type table )[[Custom]],
ExpandCustom = Table.ExpandTableColumn(AddedCustom, "Custom", {"Region", "User ID", "Group Index New"}, {"Region", "User ID", "Group Index New"}),
DetectType = Table.TransformColumnTypes(ExpandCustom,{{"Region", type text}, {"User ID", Int64.Type}, {"Group Index New", Int64.Type}})
in
DetectType
.
With this result