Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I need to create a new table combining six columns into two columns and keep the identifiers. The exisiting table is:
question_id | respondent_id | Pos1 | Pos2 | Pos3 | Neg1 | Neg2 | Neg3 |
1 | 1 | x | |||||
2 | 1 | x | |||||
3 | 1 | x | |||||
1 | 2 | xx | |||||
2 | 2 | xx | |||||
3 | 2 | x |
The new table should look like this:
question_id | respondent_id | Positive | Negative |
Positive should be a union of Pos1, Pos2, Pos3 and Negative Neg1, Neg2, Neg3
Any thoughts?
Solved! Go to Solution.
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.
Regards
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.
Regards
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.
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_id | Positive | Negative |
1 | Pos1 | Neg1 |
1 | Pos2 | Neg2 |
1 | Pos3 | Neg3 |
2 | Pos1 | Neg1 |
2 | Pos2 | Neg2 |
2 | Pos3 | Neg3 |
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.
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
95 | |
77 | |
68 | |
54 |
User | Count |
---|---|
144 | |
105 | |
102 | |
89 | |
63 |