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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

DAX Fomula for Combining Multiple Columns?

So I have a database with several thousand rows, with each row representing a unique architectural project, and our approach to recording the types of projects is to place an 'X' in one or multiple columns for that project's row for "Renovation", "Addition" and "New Construction" (many projects will fall into 2 categories.)  I'm struggling to visualize how to covert these X's into a single new column that I can use to create a dropdown slicer to filter a table based on the selected project types.  Do I need to Transpose or Pivot or would a single calculated value approach be sufficient?  Any help would be appreciated.

 

Thanks.

 

Screenshot.png

 

2 ACCEPTED SOLUTIONS
djallarii
Helper I
Helper I

The option you are looking for is in the Power Query editor which can be opened in either Power BI or Excel. I am assuming you know how to get to this point but if you need help, let me know.


Once your data is loaded into Power Query, select the last 3 columns of your data, click on the Transform tab, and find the Unpivot Columns tool.

 

This will change the layout of your dataset to 4 total columns. Two containing Project # and Project Name and two new columns called Attributes, with your project types, and Values, with the Xs.

 

Here's more info - https://support.microsoft.com/en-gb/office/unpivot-columns-power-query-0f7bad4b-9ea1-49c1-9d95-f5882...

View solution in original post

Based on the image you provided and the description of what you're trying to do, there's actually no DAX needed at all.

 

The steps below are assuming the source data is an Excel document formatted as indicated in the image you provided.

 

If the source data is in a true database, then the first few steps may be a bit different.

 

Step 1: Open Power BI, select Import data from Excel, and navigate to and select the source file.

 

Step 1.PNGStep 1b.PNG

 

Step 2: Select the source table from the options on the left and then click Transform Data. This will open the Power Query Editor

 

Step 2.PNG

 

Step 3: Hold CTRL and click column header Renovation, Addition, New Construction

 

djallarii_1-1690553444779.png

 

Step 4: Click the Transform tab on the tool ribbon and then click Unpivot Columns 

 

Step 4.PNG


Step 5: Double-click the Attribute column to rename it accordingly

 

Step 5.PNG

Step 6: Double-click the Value column to rename it accordingly, though once the data is unpivoted, this field is no longer necessary and can actually be removed.

 

Step 7: Click Home on the tool ribbon and selected Close & Apply

 

djallarii_3-1690553581453.png

 

Now your data is formatted for your described use. You can add Project #, Project Name, and Project Type to the columns of a table, and add Project Type to a slicer.

djallarii_4-1690553759608.png

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Thanks for the quick response and for the link to better understand the unpivot tool.  I assume from there I should use a calculated column with an "IF" function to place the desired values "Renovation", "Addition", and "New Construction" in this new column that will become my dropdown slicer.  I am new to DAX, but does that approach make sense? 

 

Thanks again.

Based on the image you provided and the description of what you're trying to do, there's actually no DAX needed at all.

 

The steps below are assuming the source data is an Excel document formatted as indicated in the image you provided.

 

If the source data is in a true database, then the first few steps may be a bit different.

 

Step 1: Open Power BI, select Import data from Excel, and navigate to and select the source file.

 

Step 1.PNGStep 1b.PNG

 

Step 2: Select the source table from the options on the left and then click Transform Data. This will open the Power Query Editor

 

Step 2.PNG

 

Step 3: Hold CTRL and click column header Renovation, Addition, New Construction

 

djallarii_1-1690553444779.png

 

Step 4: Click the Transform tab on the tool ribbon and then click Unpivot Columns 

 

Step 4.PNG


Step 5: Double-click the Attribute column to rename it accordingly

 

Step 5.PNG

Step 6: Double-click the Value column to rename it accordingly, though once the data is unpivoted, this field is no longer necessary and can actually be removed.

 

Step 7: Click Home on the tool ribbon and selected Close & Apply

 

djallarii_3-1690553581453.png

 

Now your data is formatted for your described use. You can add Project #, Project Name, and Project Type to the columns of a table, and add Project Type to a slicer.

djallarii_4-1690553759608.png

djallarii
Helper I
Helper I

The option you are looking for is in the Power Query editor which can be opened in either Power BI or Excel. I am assuming you know how to get to this point but if you need help, let me know.


Once your data is loaded into Power Query, select the last 3 columns of your data, click on the Transform tab, and find the Unpivot Columns tool.

 

This will change the layout of your dataset to 4 total columns. Two containing Project # and Project Name and two new columns called Attributes, with your project types, and Values, with the Xs.

 

Here's more info - https://support.microsoft.com/en-gb/office/unpivot-columns-power-query-0f7bad4b-9ea1-49c1-9d95-f5882...

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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