Forum Discussion
Anonymous
8 years agoNot applicable
Need advice on data model
Hello! as a Power BI beginner I would appreciate some advice for a (probably rather simple) data model. My data source is one single table (>200.000 rows). It lists order forms (unique ID is t...
- 8 years ago
Hi Anonymous,
In addition, here is also a good article about how to Pivot and Unpivot with Power BI for your reference. :smileyhappy:
Regards
Greg_Deckler
8 years agoCommunity Champion
Take a look at this. Basically select your categories columns and unpivot:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUSopKk0FUmmJOcWp6NxYnWglIyRJdBqsGKTIGKETCwVSYYLLDpiaWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [OrderNr = _t, Cat.1 = _t, Cat.2 = _t, Cat.3 = _t, Cat.4 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"OrderNr", Int64.Type}, {"Cat.1", type logical}, {"Cat.2", type logical}, {"Cat.3", type logical}, {"Cat.4", type logical}}),
#"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"OrderNr"}, "Attribute", "Value")
in
#"Unpivoted Columns"