Forum Discussion
How can I keep data from a list of static column names plus two dynamic column names?
- 2 years ago
= Table.SelectColumns(#"Changed Type",List.Select(Table.ColumnNames(#"Changed Type"),each List.Contains({"Issue key", "Summary", "Status", "Resolution", "Components", "Labels", "Parent", "Custom field (Story Points)", "Custom field (Epic/Theme)", "Custom field (Resolution Category)"},_,(x,y)=>Text.StartsWith(y,x))))
- Anonymous2 years ago
Hi,
Thanks for the soluton wdx223_Daniel provided, and i want to offer some more information for user to refer to.
hello petrawiggin , you can create a new step named custom1 and input the following code.
=Table.SelectRows(Table.FromList(Table.ColumnNames(#"Changed Type")),each Text.Contains([Column1],"Label") or Text.Contains([Column1],"Component"))Then after the custom1 step create a new step named custom2
={"Issue key", "Summary", "Status", "Resolution","Parent", "Custom field (Story Points)", "Custom field (Epic/Theme)", "Custom field (Resolution Category)"}&Custom1[Column1]Then create a new step after custom2 named custom3
= Table.SelectColumns(#"Changed Type",Custom2)Output
When I add new column named label 7 component 7 , then will both diplay.
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Amazing! This did the trick!
Can you explain what that last part means so I can know how to use it better for other situations?
- What does the ,_, do?
- What does (x,y)=> mean?
- Based on the Text.StartsWith, I'm guessing that the y is somehow "any of the category names I just listed" but I don't know how it's that, if it is.
- What is the x, which, based on the Text.StartsWith, seems to mean either "anything" or "_any number" but I'm not sure how, again.
Thank you so much for your solution and further help!
_ is each item comes from Table.ColumnNames, ie the first parameter of List.Select
x is each item of the first parameter of List.Contains
y is the second parameter of List. Contains
(x,y)=>Text.StartsWith(y,x), is to define "What the mean of Contain"