Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
I have trouble cleaning data in PowerBi. So I would like to know two things. The first is how do I clean the data example below. The second question, would there be any classes or any resources to help me clean data properly as the example is not as complex as some of the items in my queue.
For the example below I have watched a video from MS PowerBi on "Clean data to include in a report" but it did not go deep enough to help me. I need to display the entity, measure, the actual data, all by date. Basically a trend over time for this specfic example.
Example:
Date | Measure | Entity1 | Entity2 | Entity3 | Entity4 | Average | |
9/7/22 | measure1 | .99 | .98 | .98 | .95 | .975 | |
9/7/22 | measure2 | 1 | 1 | 1 | 1 | 1 | |
9/7/22 | measure3 | .95 | .95 | .95 | .95 | .95 | |
9/14/22 | measure1 | .9 | .9 | .9 | .9 | .9 | |
9/14/22 | measure2 | 0 | 1 | .9 | .5 | .6 | |
9/14/22 | measure3 | .3 | .7 | .7 | .9 | .65 | |
9/21/22 | measure2 | 1 | 1 | 1 | 1 | 1 | |
9/21/22 | measure3 | .9 | .9 | .9 | .9 | .9 |
Please let me know if you have any additonal questions
Thanks in advance
Solved! Go to Solution.
Hi @JAmbrose69 ,
For the data that you present I believe that you need to unpivot your data. On Power Query select the columns Date and measure and then on Transform Select Unpivot Other columns:
You will get a table with 4 columns:
Rename the Attribute column and you should be all set:
Now you can do a filter on measure or create the value based on entity:
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsThere is a basic rule - Power BI wants narrow tables. Your sample data is a prime example of what not to do - using wide tables. So the most frequent cleaning technique is "unpivoting"
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WstQ31zcyUtJRyk1NLC4tSjUEMvUsLcGkBRJpqhSrg6kaxDREwdhUGUNNwCQhqg1NsDgBncCqFMQ0gNoNUYjDTLATwIQ5nICZaWRIlJ/QlBljd2UsAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, Measure = _t, Entity1 = _t, Entity2 = _t, Entity3 = _t, Entity4 = _t]),
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"Date", "Measure"}, "Entity", "Value"),
#"Changed Type" = Table.TransformColumnTypes(#"Unpivoted Other Columns",{{"Date", type date}, {"Value", type number}})
in
#"Changed Type"
Note that I also dropped the Average column - that can be computed in Power BI.
Hi @JAmbrose69 ,
For the data that you present I believe that you need to unpivot your data. On Power Query select the columns Date and measure and then on Transform Select Unpivot Other columns:
You will get a table with 4 columns:
Rename the Attribute column and you should be all set:
Now you can do a filter on measure or create the value based on entity:
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsMarch 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
144 | |
74 | |
63 | |
51 | |
48 |
User | Count |
---|---|
211 | |
86 | |
64 | |
59 | |
56 |