Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Reorder columns by listing only those column names to be moved

I have a Power Query that imports data from JSON URLs which I am constantly switching so that many of the headers change

But All JSON data share some headers

 

{"Id", "Label", "Email", "Project Name", "Type", "Segment", "Description", "First Name", "Last Name", "Email 2", "Email 3", "Initial Date", "Last Date", "Image"}

 

I want to move these to the "front" of the table

I tried this

 

#"Appended Query" = Table.Combine({#"Changed Type", addMissingEmails}),
#"Reordered Columns" = Table.ReorderColumns(#"Appended Query",{"Id", "Label", "Email", "Project Name", "Type", "Segment", "Tags", "Description", "First Name", "Last Name", "Email 2", "Email 3", "Initial Date", "Last Date", "Master ID", "sumApp Link", "Image"},MissingField.Ignore),

 

 But it does NOT move ALL columns listed to the front of the table

 

Is there a way to do this?

Thank you in advance

1 ACCEPTED SOLUTION
ronrsnfld
Super User
Super User

Something like:

 

firstColumns = {"Id", "Label", "Email", "Project Name", "Type", "Segment", "Description", "First Name", "Last Name", "Email 2", "Email 3", "Initial Date", "Last Date", "Image"},

#"Reordered Columns" = Table.ReorderColumns(#"Appended Query",firstColumns & List.RemoveMatchingItems(Table.ColumnNames(#"Appended Query"),firstColumns))

 

 

View solution in original post

2 REPLIES 2
ronrsnfld
Super User
Super User

Something like:

 

firstColumns = {"Id", "Label", "Email", "Project Name", "Type", "Segment", "Description", "First Name", "Last Name", "Email 2", "Email 3", "Initial Date", "Last Date", "Image"},

#"Reordered Columns" = Table.ReorderColumns(#"Appended Query",firstColumns & List.RemoveMatchingItems(Table.ColumnNames(#"Appended Query"),firstColumns))

 

 

Anonymous
Not applicable

Thank you. That sorted it!

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors