Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
afleiderman1
Helper I
Helper I

Formatting a power bi matrix table

I am wondering is there a way to format a power bi report I have the following type

of chart 

 

0-grocery                                             2-dairy                                                                      3-frozen

actual  predicted picked                  actual   predicted   picked                               actual      predicted picked 

 

I have my column are the store which incldue  [0-grocery,2-dairy,3-frozen ]

and my values are actual predicted and pick which are column values

 

afleiderman1_0-1674050007051.png

 

 

But want is to have something like this

 

ACTUAL                                                                    PREDICTED                                                      PICKED

0-grocery  2-dairy  3-frozen                       0-grocery   2-dairy    3-frozen                      0-grocery    2-dairy      3-frozen

 100           120          130                       90                   80              30                                   90              20           40 

 

 

Not sure how I could get something like this.                

1 ACCEPTED SOLUTION

Hi @afleiderman1 ,

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:

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"

yingyinr_0-1674181475898.png

 

2. Sort the column [Type] by the column[Index], then create a matrix visual with the below settings

yingyinr_1-1674181643411.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
afleiderman1
Helper I
Helper I

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 @afleiderman1 ,

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:

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"

yingyinr_0-1674181475898.png

 

2. Sort the column [Type] by the column[Index], then create a matrix visual with the below settings

yingyinr_1-1674181643411.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-yiruan-msft
Community Support
Community Support

Hi @afleiderman1 ,

You can create a matrix visual as below with the below setting as below screenshot:

yingyinr_0-1674096852572.png

If the above one can't help you, could you please provide more raw data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following links to share the required info:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.