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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Dear all, good afternoon.
Can you help me with this problem?
Table with the code used:
let
Fonte = BD_Geral,
#"Outras Colunas Removidas" = Table.SelectColumns(Fonte,{"Nº CTe", "Nome"}),
#"Linhas Classificadas" = Table.Sort(#"Outras Colunas Removidas",{{"Nº CTe", Order.Ascending}}),
#"Linhas Agrupadas" = Table.Group(#"Linhas Classificadas", {"Nº CTe"}, {{"Tranportadoras", each _, type table [Nº CTe=nullable number, Nome=nullable text]}}),
#"Tranportadoras Agregado" = Table.AggregateTableColumn(#"Linhas Agrupadas", "Tranportadoras", {{"Nome", List.Distinct, "Contagem de Tranportadoras.Nome"}}),
#"Contagem de Tranportadoras.Nome Expandido" = Table.ExpandListColumn(#"Tranportadoras Agregado", "Contagem de Tranportadoras.Nome")
in
#"Contagem de Tranportadoras.Nome Expandido"
Desired result:
As an example of 52, it started with 0 and then went to 1. If there was a third repeated number, it would go to 2, and so on.
Solved! Go to Solution.
Hi @Incamus ,
Please refer the steps below.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUUpMVIrViVYyQjCNEUwTIDMpCc5MTgYzTYHMlBQw0wzITE2FM9PS4MyMDKXYWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Nº Cte" = _t, #"Contagem de Tranportadoras.Nome" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Nº Cte", Int64.Type}, {"Contagem de Tranportadoras.Nome", type text}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Nº Cte"}, {{"Data", each Table.AddIndexColumn(_, "Index", 0, 1, Int64.Type)}}),
#"Expanded Data" = Table.ExpandTableColumn(#"Grouped Rows", "Data", {"Contagem de Tranportadoras.Nome", "Index"}, {"Contagem de Tranportadoras.Nome", "Index"})
in
#"Expanded Data"
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Hi @Incamus ,
Please refer the steps below.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUUpMVIrViVYyQjCNEUwTIDMpCc5MTgYzTYHMlBQw0wzITE2FM9PS4MyMDKXYWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Nº Cte" = _t, #"Contagem de Tranportadoras.Nome" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Nº Cte", Int64.Type}, {"Contagem de Tranportadoras.Nome", type text}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Nº Cte"}, {{"Data", each Table.AddIndexColumn(_, "Index", 0, 1, Int64.Type)}}),
#"Expanded Data" = Table.ExpandTableColumn(#"Grouped Rows", "Data", {"Contagem de Tranportadoras.Nome", "Index"}, {"Contagem de Tranportadoras.Nome", "Index"})
in
#"Expanded Data"
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
The solution worked, thanks @Anonymous
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.