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.
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.
- petrawiggin2 years ago
Helper I
Hello.
This is a great solution for if I need to be careful to ONLY include the extra component or label columns!
Do you have a sense of whether this solution or the one-step one from @wdx223_Daniel would be more processing-heavy? Or if there is a way for me to tell?
(Since there is pretty much no way the other columns would have duplicates I might not need this many steps but if it's more efficient to run then I will definitely use it. And either way I will keep it for future reference because it is so handy!)
Am I correct in interpreting this solution as:- take all the column names from my data and make that into a list, then a one-column table then find all the names in that list that start with component or label
- make a list of the other columns I want to keep and add to it the names of the columns generated by step 1
- go back to the original table and keep only the columns from it that match the new list from step 2
- petrawiggin2 years ago
Helper I
Just checking back in. I wound up having to use this multi-step solution because there were other columns that started with other words that I didn't want. So thank you for this more specific solution as well!