question

kirukim-9614 avatar image
0 Votes"
kirukim-9614 asked kirukim-9614 commented

Iterate over a table using M

83248-1.png



I need your help!!
I've this table and i wanna iterate over it to have each value in the first column with all the values in the second column

For example i should get a table with the following values :
A B
A C
A D
A X
A Y
A Z
A F
A E
B X
B Y
.
.
.
..
and it should stop when we'll no more having values from the second column in the first one

power-query-not-supported
1.png (8.3 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

JimDavis-5573 avatar image
0 Votes"
JimDavis-5573 answered kirukim-9614 commented

I'm pretty sure there is a way to do this with an inline function but this works for me and I think is pretty clear and simple:

let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{ {"Appelant", type text}, {"Appele", type text}}),
SecondCol = Table.FromList(List.Distinct(#"Changed Type"[Appele]), null, {"Appele"}),
FirstCol = Table.FromList(List.Distinct(#"Changed Type"[Appelant]), null, {"Appelant"}),
Joined = Table.AddColumn(FirstCol, "Appele", each SecondCol),
#"Expanded Appele" = Table.ExpandTableColumn(Joined, "Appele", {"Appele"}, {"Appele"})
in
#"Expanded Appele"

Hope this helps!

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

This is helpful but it's not what i want it was my problem i didn't explain it in the good way

It's kinf of calling called game, if a call you and you call someone i should know all the persons in this calling !process
I made a picture that represent the result.
Thankyou very much for your reply


[1]: /answers/storage/attachments/83609-x.png

[2]: /answers/storage/attachments/83577-y.png

0 Votes 0 ·
x.png (4.6 KiB)
y.png (5.0 KiB)

C only having F and E cause these two are the last level and they don't pocede values otherwise i should add their values to C

0 Votes 0 ·