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.
Hi Experts,
I am downloading data from SurveyMonkey through the plugin, and the objective is to create PowerBI reports and dashboards using the data.
My table is in the following format
UserName Application1 Application 2 Application3
ABC AppA AppB AppC
DEF AppF AppE null
GHI AppA AppB null
JKL AppE null null
Reports' requirement is to identify users and count of applications, something like this
ABC 3
DEF 2
GHI 2
JKL 1
Is there a way we can convert the original table to show something like this (and create reports sourcing it)
ABC AppA
ABC AppB
ABC AppC
DEF AppF
DEF AppE
GHI AppA
In a DB, I would have done it using union statements, as an example
select UserName, Application1 as APP
union
select UserName, Application2 as APP
union
select UserName, Application3 as APP
any suggestions on how to do it in power BI
Thanks in advance
...
Solved! Go to Solution.
Yep no problem.
1. Start by loading your data into Power BI/Power Query and open the query editor (click Transform Data on the Ribbon in PBI). Your source data looks like this
2. Select the 3 columns and then right click on one of the column headers. Choose Unpivot Columns from the menu
3. You end up with this
4. Filter null values out of the Value column
5. Delete the Attribute column
Regards
Phil
Proud to be a Super User!
this is exactly what I was looking for... Can you please walk me through the steps (or direct me to the tutorial) so that I can understand the process.
Thanks again
Yep no problem.
1. Start by loading your data into Power BI/Power Query and open the query editor (click Transform Data on the Ribbon in PBI). Your source data looks like this
2. Select the 3 columns and then right click on one of the column headers. Choose Unpivot Columns from the menu
3. You end up with this
4. Filter null values out of the Value column
5. Delete the Attribute column
Regards
Phil
Proud to be a Super User!
Download this sample PBIX file with code
You can unpivot the data in Power Query
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcnRyVtJRciwocIRQThDKWSlWJ1rJxdUNwoVSrkAqrzQnByzp7uGJoRMu6eXtg6YFJhkLAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [UserName = _t, App1 = _t, App2 = _t, App3 = _t]),
#"Unpivoted Columns" = Table.UnpivotOtherColumns(Source, {"UserName"}, "Attribute", "Value"),
#"Filtered Rows" = Table.SelectRows(#"Unpivoted Columns", each ([Value] <> "null")),
#"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Attribute"})
in
#"Removed Columns"
Regards
Phil
Proud to be a Super User!
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 |
---|---|
110 | |
97 | |
78 | |
64 | |
55 |
User | Count |
---|---|
143 | |
109 | |
89 | |
84 | |
66 |