Here you can find easy-to-apply steps that will help you with changing data sources and reordering columns steps.
As you probably know, your query can have only one reorder step, at the end for example. All reordering steps can be deleted once you finish building your query.
There is a risk that your query will crash and return an error, once your source with for example month/year in the column name will change. The error will be displayed, once only one or more columns won’t be found in your source.
How to avoid that and prepare a query for extending sources with applied desired reordering? Just change your last reordering step with the below code and your column names in the ColumnNames step.
ColumnNames = {"ID","2022.11", "2022.12", "2022.10", "2023.01", "2023.02", "2023.03", "2023.04", "2023.05", "2023.06", "2023.07", "2023.08", "2023.09", "2023.10", "2023.11", "2023.12", "Comment"},
ExistingColumns = Table.ColumnNames(PreviousStepName),
ColumnsToReorder = List.Intersect({ColumnNames, ExistingColumns}),
ReorderedColumns = Table.ReorderColumns(PreviousStepName, ColumnsToReorder)
In
ReorderedColumns
Leave a comment