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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Jannis68
Frequent Visitor

Creating a new table in Power BI combining columns

I need to create a new table combining six columns into two columns and keep the identifiers. The exisiting table is:

 

question_idrespondent_idPos1Pos2Pos3Neg1Neg2Neg3
11x     
21x     
31x     
12xx     
22xx     
32x     

 

The new table should look like this:

 

question_idrespondent_idPositiveNegative

 

Positive should be a union of Pos1, Pos2, Pos3 and Negative Neg1, Neg2, Neg3

 

Any thoughts?

 

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION
v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @Jannis68,

 

If I understand you correctly, you should be able to use the Unpivot Columns option in Query Editor to unpivot the Pos columns and Neg columns separately to get the expected result in your scenario.

 

For more details about how to Pivot and Unpivot with Power BI, you can refer to this article. Smiley Happy

 

Regards

View solution in original post

7 REPLIES 7
v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @Jannis68,

 

If I understand you correctly, you should be able to use the Unpivot Columns option in Query Editor to unpivot the Pos columns and Neg columns separately to get the expected result in your scenario.

 

For more details about how to Pivot and Unpivot with Power BI, you can refer to this article. Smiley Happy

 

Regards

Rfranca
Resolver IV
Resolver IV

hi, @Jannis68

 

When do you want to make that combination?
When importing data or when creating a measure?
Because depending on the moment you can use DAX functions or M functions.

Of more details of the moment of this combination.

I have no preference wheter using on import or when creating a DAX.

@Jannis68

 

Using DAX you can create a calculated Table

 

Go to Modelling Tab>>>NEW TABLE and use this formula

 

Table =
SUMMARIZE (
    TableName,
    TableName[question_id],
    TableName[respondent_id],
    "Positive", SUM ( TableName[Pos1] ) + SUM ( TableName[Pos2] )
        + SUM ( TableName[Pos3] ),
    "Negative", SUM ( TableName[Neg1] ) + SUM ( TableName[Neg2] )
        + SUM ( TableName[Neg3] )
)

 

 

Thanks for input. Actually this is not what I was looking for.  I would like the new table to look like:

 

question_idPositiveNegative
1Pos1Neg1
1Pos2Neg2
1Pos3Neg3
2Pos1Neg1
2Pos2Neg2
2Pos3Neg3

 

 

Hi,

 

For further clarity, please take a clearer example.  Instead of xx, show some data under the Pos and negative columns and on that dataset, show your desired result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Jannis68

 

Using Query Editor,

 

You can add new columns ...

Select the Columns you want to sum/combine>>>Go to "Add Column" Tab>>>Statistics>>>sum

 

Picture below shows this

 

5894.png

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.