Home > Computer Tutorials > Computer Knowledge > How to reorder multiple columns in Power Query via drag and drop

How to reorder multiple columns in Power Query via drag and drop

PHPz
Release: 2024-03-14 10:55:02
forward
818 people have browsed it

In this article, we will show you how to reorder multiple columns in Power Query by dragging and dropping. Often, when importing data from various sources, columns may not be in the desired order. Reordering columns not only allows you to arrange them in a logical order that suits your analysis or reporting needs, it also improves the readability of your data and speeds up tasks such as filtering, sorting, and performing calculations.

如何通过拖放在Power Query中对多列进行重新排序

How to rearrange multiple columns in Excel?

In Excel, there are many ways to rearrange columns. You can simply select the column header and drag it to the desired location. However, this approach can become cumbersome when dealing with large tables with many columns. To rearrange columns more efficiently, you can use the enhanced query editor. With the enhanced query editor, you can easily select multiple columns in the order you need and drag them together to the desired location. This allows you to quickly rearrange columns in large tables without having to constantly drag and scroll. The enhanced query editor provides a more convenient way to manage and adjust the order of columns, making your work more efficient and convenient.

How to reorder multiple columns in Power Query using drag and drop functionality

To reorder multiple columns in Power Query via drag and drop, you must perform the following steps:

Suppose we have a sample data source as shown below. So our first step is to open it in the Power Query editor. Select the data source and click the From table/range option in the Get data section under the Data tab.

如何通过拖放在Power Query中对多列进行重新排序

&Reorder multiple columns using drag and drop

After opening data in the Enhanced Query Editor, you can customize the display order by holding down the Ctrl key and selecting the desired columns. For example, you can rearrange DepartmentID and EmployeeID to suit your needs. This flexibility allows you to easily adjust the order of data display to suit your specific needs and preferences.

Department ID, employee ID, employee name, joining date, gender, salary code

I will select them in the order shown in the screenshot below:

如何通过拖放在Power Query中对多列进行重新排序

After selecting the columns, click and hold the left mouse button on any selected column header, then drag the pointer to where you want to place the column. Release the mouse button to drop the column to its new location. They will be rearranged in the desired order.

如何通过拖放在Power Query中对多列进行重新排序

Finally, click the Close&Load button in the top menu of the Power Query editor to apply the changes and load the reordered data back into the worksheet.

如何通过拖放在Power Query中对多列进行重新排序

Note:

  • If you want to rearrange all columns in the data source, you must drag the selection to the right of the last column and release the mouse button. If you drag the column to the left, nothing happens.
  • To reverse the order of columns in the data source, select the last column, hold down the Shift key, and then select the first column. Then click and hold the left mouse button on the last column header and drag the pointer to the right. Release the mouse button and the column order will be reversed. You can follow the same steps to reverse the order of just a few columns. This also allows the selection to be dragged to the left.
  • To "Undo" a reordering, right-click on the "Reordered Columns" step under "Applied Steps" in the query settings panel on the right and select "Delete".
  • Another way to reorder columns in Power Query

    When you reorder columns in Power Query, a Table.ReorderColumns function is created. You can also reorder multiple columns at once by modifying the formula text in the Table.ReorderColumns function. ReorderColumns function (if you cannot see this function, right-click on any column header and select Move > Left/Right/To Begin/to End from the context menu).

    Edit the formula text by placing your cursor on the top formula bar and typing the column headings in the desired order. Titles are enclosed in double quotes and separated by commas. Delete the previous entry for the added column and press Enter to apply the changes.

    This is how to quickly reorder multiple columns in Power Query without having to move each column individually. I hope you'll find this useful.

    The above is the detailed content of How to reorder multiple columns in Power Query via drag and drop. For more information, please follow other related articles on the PHP Chinese website!

    Related labels:
    source:mryunwei.com
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template