Forum Discussion
Formatting a power bi matrix table
- Anonymous3 years ago
Hi Anonymous ,
I created a sample pbix file(see the attachment), please check if that is what you want. You can find the details in the attachment.
1. Handle with it in Power Query Editor:
- Select the column [Actual], [Prediction] and [Picked] and unpivot these selected columns
- Add one custom column [Index]
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtBNL8pPTi2qVNJRMjQwAJJGYNLSQClWJ1rJSDclMbOo8tACiBBQ1hBEGBkpxcYCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Facility = _t, Actual = _t, Prediction = _t, Picked = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Facility", type text}, {"Actual", Int64.Type}, {"Prediction", Int64.Type}, {"Picked", Int64.Type}}), #"Unpivoted Only Selected Columns" = Table.Unpivot(#"Changed Type", {"Actual", "Prediction", "Picked"}, "Type", "Value"), #"Added Custom" = Table.AddColumn(#"Unpivoted Only Selected Columns", "Index", each if [Type]="Prediction" then 1 else if [Type]="Actual" then 2 else 3) in #"Added Custom"2. Sort the column [Type] by the column[Index], then create a matrix visual with the below settings
Best Regards
I guess my issue is the way my data is set up
I have my columns are like this
for example
Facility Actual Prediction Picked
0-grocery 100 200 90
2-dairy 90 21 222
I am not sure how to get a type column to distinguish them.
Hi Anonymous ,
I created a sample pbix file(see the attachment), please check if that is what you want. You can find the details in the attachment.
1. Handle with it in Power Query Editor:
- Select the column [Actual], [Prediction] and [Picked] and unpivot these selected columns
- Add one custom column [Index]
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtBNL8pPTi2qVNJRMjQwAJJGYNLSQClWJ1rJSDclMbOo8tACiBBQ1hBEGBkpxcYCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Facility = _t, Actual = _t, Prediction = _t, Picked = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Facility", type text}, {"Actual", Int64.Type}, {"Prediction", Int64.Type}, {"Picked", Int64.Type}}),
#"Unpivoted Only Selected Columns" = Table.Unpivot(#"Changed Type", {"Actual", "Prediction", "Picked"}, "Type", "Value"),
#"Added Custom" = Table.AddColumn(#"Unpivoted Only Selected Columns", "Index", each if [Type]="Prediction" then 1 else if [Type]="Actual" then 2 else 3)
in
#"Added Custom"
2. Sort the column [Type] by the column[Index], then create a matrix visual with the below settings
Best Regards