Unpivot Column Pairs in Excel & Power BI with Power Query
Power BI
Feb 23, 2024 10:24 PM

Unpivot Column Pairs in Excel & Power BI with Power Query

by HubSite 365 about David Benaim

Data AnalyticsPower BILearning Selection

Master Unpivoting Column Pairs in Excel & Power BI with Power Query Guide

Key insights


Unpivoting columns in Power Query is crucial for transforming data from wide to long formats, especially when dealing with column pairs. This technique allows for more effective data analysis and visualization in Excel and Power BI. Here's a concise summary of how to accomplish this:

  • Identify the column you want to keep as the identifier for each pair.

  • Select all other columns and utilize the Unpivot Other Columns feature under the Transform tab.

  • Split the "Attribute" column if needed, to further divide the original column names for detailed analysis.

  • Rename the new columns appropriately and remove the "Attribute" column if it's no longer needed.

  • For multiple column pairs, repeat the process for each pair, adjusting techniques for complex scenarios.


By adhering to these steps, users can efficiently transform their data into a more analyzable format. This method is particularly useful for handling multiple attributes of the same entity, allowing for deeper insights and easier data management.


Understanding Unpivoting in Power Query

Data transformation is a fundamental aspect of data analysis and visualization, with unpivoting being a key technique. Unpivoting transforms data from a wide format, which might have numerous columns representing different attributes of a single entity, to a long format that simplifies analysis, especially in tools like Excel and Power BI. Knowing how to manipulate data efficiently can reveal insights that would remain obscured in a wide-format dataset.

When dealing with complex datasets, understanding how to unpivot column pairs or triples becomes crucial. This operation contributes to a cleaner, more organized dataset that's easier to navigate and analyze. It simplifies the process of comparing and contrasting different data points by aligning them in a single, coherent structure.

The versatility of Power Query allows users to tackle common data transformation challenges, such as dealing with duplicates or multi-row headers. Beyond the basic steps of unpivoting, Power Query offers more advanced functionalities like custom functions and splitting columns by delimiters. These features enable users to tailor their datasets to specific analytical needs, accommodating various data types and structures.

Moreover, the ability to rename and remove unnecessary columns after the unpivot operation ensures that only relevant data is kept for analysis. This streamlined approach enhances the clarity and focus of the dataset, making it easier to draw actionable insights. Whether you're a seasoned analyst or a beginner, mastering unpivoting in Power Query is an invaluable skill that can significantly boost your data analysis capabilities.


Unpivoting column pairs in software like Excel and similar tools is a key process for data analysis. The technique is especially crucial when working with data spread across multiple columns that represent various attributes of the same item or entity. David Benaim demonstrates the process in a concise manner, providing a step-by-step guide to efficiently convert these columns into rows, making the data more suitable for analysis.

At the beginning, Benaim introduces the concept and importance of unpivoting columns, focusing on how to handle pairs of columns. A critical first step involves identifying a unique identifier column that you wish to keep constant. Afterward, the process continues with selecting the rest of the columns for the unpivoting process. This action will generate two new columns, one for the attribute names and another for their corresponding values, drastically simplifying data handling and analysis.

An optional but beneficial step involves splitting the newly created "Attribute" column to further separate out details that were combined in the original column names. This advanced step can be achieved by using a delimiter to split the column, enhancing the granularity of the data analysis. After splitting, renaming and removing columns as necessary ensures the final dataset is organized and tailored for specific analysis needs.

Benaim's tutorial not only walks through the practical steps of unpivoting column pairs but also suggests additional tips for handling more complicated data structures and recommends resources for further learning. This could include employing custom functions or exploring advanced techniques tailored to complex scenarios. By adapting the tutorial’s methods, viewers can efficiently refactor their data within the Power Query interface, making it ripe for deeper analysis and insights.

  • Identify the column to keep as a unique identifier.
  • Select all other columns and choose "Unpivot Other Columns" from the Transform tab.
  • Optionally split the "Attribute" column for further details.
  • Rename and remove columns as needed for clarity.

Following these steps, viewers can effectively unpivot column pairs, transforming their data into a more analysis-friendly format. The tutorial by David Benaim serves as a fundamental guide for those looking to refine their data manipulation skills within Excel and Power BI, two powerful tools for data analysis.

Expanding on Data Analysis Techniques in Power BI and Excel

Data analysis in today’s world requires not just understanding, but mastering various tools and techniques. Power BI, among other tools, stands out as a significant asset for data analysts worldwide. The software's ability to unpivot columns—a process discussed by David Benaim—is just the tip of the iceberg when it comes to its capabilities. Analyzing data efficiently involves transforming it into a format that is easily understandable and ready for insight extraction.

Unpivoting is a crucial step in data preparation, especially when dealing with large datasets that include multiple attributes represented in columnar form. This process helps in normalizing the data structure, making it more accessible for detailed analysis and visualization. The method allows analysts to convert data from a wide format, often unwieldy and difficult to navigate, into a long format that is far more conducive to exploration and visual representation.

Furthermore, mastering this technique opens up a plethora of possibilities for data manipulation and analysis. It lays the groundwork for more advanced data analysis operations, such as custom calculations, predictive analytics, and comprehensive data modeling. Power BI and its Power Query interface provide a robust platform for these activities, catering to a variety of analytical needs and skill levels.

Finally, as datasets grow in complexity and size, the need for efficient data transformation processes becomes increasingly critical. Techniques for unpivoting columns enable analysts to handle this complexity, ensuring that data remains a valuable and interpretable asset. Whether for business intelligence, research, or operational analysis, understanding and applying these techniques is a key step towards achieving deeper insights and making informed decisions.


Unpivoting column pairs in Power Query for Excel & Power BI is often necessary for analysis. The process involves converting columns into rows, which is handy when dealing with multiples of attributes for the same entity, such as pairs or triples of columns. In this YouTube video, the presenter walks through the entire process using Power Query, detailing how to handle situations with multi-row headers and duplicates.

Starting with an introduction to unpivoting column pairs, the video emphasizes its usefulness in transforming data from wide to long format for enhanced analysis. The presenter explains how to select columns to keep, unpivot other columns, and manage the resulting 'Attribute' and 'Value' columns. This method is particularly effective for analyzing data that comes in pairs of columns, representing different attributes of the same entity.

Further into the video, optional steps such as splitting the 'Attribute' column for additional details and renaming or removing unnecessary columns are discussed. These steps ensure a clean, analysis-ready dataset. The tutorial also includes advanced tips for dealing with more complex scenarios, highlighting the flexibility of Power Query in data manipulation.

  • Select the Column to Keep: Identify the column you want to retain as the identifier.
  • Unpivot Other Columns: Select all columns except the one to keep and choose Unpivot Other Columns.
  • Split the "Attribute" Column (Optional): Split the "Attribute" column by delimiter if needed.
  • Rename and Remove Unnecessary Columns: Rename according to your needs and remove the "Attribute" column if redundant.

By following these clear steps, viewers can effectively unpivot column pairs in Power Query, making the data more suitable for further analysis or visualization. The video also points viewers to additional resources for further learning, including Microsoft documentation and a supplemental YouTube tutorial.

Enhancing Data Analysis with Power BI and Power Query

Data transformation is a critical step in data analysis and visualization, and Power BI along with Power Query offers powerful tools to accomplish this. Unpivoting column pairs is just one of the many transformations you can perform to prepare your data for analysis. Power Query excels in handling complex data structures, turning them into a format that can be easily analyzed within Power BI. This capability extends beyond simple column pairs to more complicated scenarios, enabling users to extract maximum value from their data. Whether dealing with sales data, customer information, or any other dataset, understanding how to manipulate and transform data is key to uncovering valuable insights. The video tutorial offers a step-by-step guide, making it accessible even to those new to data analysis. With Power BI and Power Query, the possibilities for data transformation and analysis are almost limitless, empowering users to make informed decisions based on comprehensive data insights.


Power BI - Unpivot Column Pairs in Excel & Power BI with Power Query


People also ask

Questions and Answers about Microsoft 365

"How do I Unpivot two columns in Power Query?"

Answer: To achieve the unpivoting of two columns, simply opt for the "Unpivot columns" feature.

"How do I Unpivot multiple columns in Excel?"

Answer: To unpivot several columns, navigate to the "Query Editor," initiate a right-click on the primary column and select "Unpivot Other Columns." This action effectively unpivots the data across your supplementary columns within the Excel table. Renaming the newly formed columns for more accurate data representation is advisable.

"How do I Unpivot columns dynamically in Power Query?"

Answer: Follow this script sequence for dynamic unpivoting:. let.Source = Excel.CurrentWorkbook(){[Name="ProductPlan"]}[Content], Cols = Table.ColumnNames(Source), ColsUnPivot=List.Skip(Cols, 1), Unpivot = Table.Unpivot(Source, ColsUnPivot, "Attribute", "Value") in Unpivot.

"How do I match two columns in Power Query?"

Answer: To match columns between tables in Power Query, execute Get Data > Combine Queries > Merge. Use the Merge dialog to select Table1 and Table2, then identify the column(s) that need to match, ensuring the columns are selected in the same sequence (Product ID, Option, Cost).



Unpivot columns, Power Query, Excel, Power BI, data transformation, Excel tutorial, Power BI guide, data reshaping