How to duplicate multiple columns using Power Query

Do you want to duplicate multiple columns using the Power Query editor?, then this tutorial will help you to duplicate multiple columns at once in Power BI. And also it explains how to remove duplicates using the Power Query editor.

Duplicate multiple columns at once using Power Query

Let us see how to duplicate multiple columns at once using the Power Query editor in Power BI,

  • In this example, I will use the Products Table data mentioned below. You can download the sample data from here, where we will make the multiple duplicate columns (two or more columns)
  • Open the Power BI desktop, and load the table data into it, In the ribbon, under the Home option click on the Transform data option as shown below:
  •  So that it will redirect to the power query editor, where we can add duplicate multiple columns to the table.
  • Select the column that you want to duplicate, right-click on it, and click on the Duplicate column as below: In this example, I have selected the index column and duplicated it once.
duplicate multiple columns at once in power query
duplicate multiple columns at once in power query
  • Now to duplicate multiple columns at once, enter the below-mentioned formula in the formula box and select the check icon.
= Table.DuplicateColumn(#"Duplicated Column", "Index - Copy", "Index - Copy - Copy - Copy ")
  • In the below screenshot, you can see that the index column has been duplicated. In the same way, follow the Select the column that you want to duplicate, right-click on it, and click on the Duplicate column. So that it will duplicate multiple columns at once.
  • The Screenshot below represents the index column that has been duplicated two times.
  • Click on the close and apply the option to reflect the changes on the Power BI desktop.
Power query duplicates multiple columns at once example
Power query duplicate multiple columns at once example

This is how to duplicate multiple columns at once using the Power Query editor in Power BI.

Read How to add an empty column in Power BI

Remove duplicates using Power Query

Let us see how to remove the duplicate values using the Power Query editor in Power BI,

  • Open the Power BI desktop, and load the table data into it, In the ribbon, under the Home option click on the Transform data option as shown below:
  •  So that it will redirect to the power query editor, where we can remove duplicate values from the table.
  • Select the column from which you want to remove duplicate values, right-click on it, and click on Remove Duplicates as below:
Power query remove duplicates
Power query removes duplicates
  • To remove duplicate values, enter the formula below in the formula box and select the check icon.
= Table.Distinct(#"Removed Duplicates", {"Count of Custom.Country"})
  • In the below screenshot, you can see that it removes duplicate values from the custom country column.
  • Click on the close and apply the option to reflect the changes on the Power BI desktop.
Power query remove duplicates example
Power query removes duplicates example

This is how to remove the duplicate values using the Power Query editor in Power BI.

This tutorial demonstrated to you how to duplicate multiple columns at once and remove the duplicate values using the Power Query editor in Power BI.

You may like the following Power BI tutorials:

>