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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Matrix Visual help

Hello Community  -  I am struggling getting the proper results in a Matrix visual.   There are two parts to my question: 

 

I have 10 different inspection criteria (being imported from an Excel table).   The format is basically this: 

 

Date of Inspection   Job #    Criteria 1    Criteria 2   Criteria 3   etc....

Jan 10 2021               769        P                 P                F  

Jan 10 2021               770        F                 P                P

Jan 11 2021               771        F                 P                P  

 

Replicating the table is of course as easy as dragging in the field names.   The 2 parts I need help with are:

1.  Creating a measure that sums up the P's and F's in each column   (P = pass, F = fail).   

2.  Displaying the results in a matrix table  (see my example below)

3.  Currently, if I use the measure below, and drag one of the criteria into the Columns area on a Matrix visual, I get this...which is not at all what I am looking for.   It is using the F and P as the column header...not the actual column name.   Again, see example below for my desired result.    Any help is very appreciated!

 

texmexdragon_1-1631294136284.png

 

Measure =


VAR _Criteria1 = COUNT(Query1[Correct labels are present and installed per work instructions ])
VAR _InspResult = CALCULATE(_Criteria1,Query1[Correct labels are present and installed per work instructions ] = "F")

RETURN
_InspResult
 
Here is what I would like to have the matrix visual look like:
            Criteria 1           Criteria 2      Criteria 3        Criteria  4     etc...  
Pass          4                          5                 11                   3
Fail           7                          6                   0                    8
 
Here is what a standard table looks like with two of the criteria.  This is fine.  
 
texmexdragon_0-1631293522906.png

 

 
 
1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

What I usually do when I get this type of data from Excel is to bring it into usable form by unpivoting

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8krMUzA0UDAyMDI8tEABCSnpKMGY5maWKHyFACyK4CgAJux2aAGQGatDpCXmBqjmuRFlSQDCAkNCFhiSZQHEF7EA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Date of Inspection   " = _t, #"Job #   " = _t, #"Criteria 1   " = _t, #"Criteria 2   " = _t, #"Criteria 3   " = _t]),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"Date of Inspection   ", "Job #   "}, "Attribute", "Value")
in
    #"Unpivoted Other Columns"

That is now in a format which Power BI likes and can use for computations

View solution in original post

1 REPLY 1
lbendlin
Super User
Super User

What I usually do when I get this type of data from Excel is to bring it into usable form by unpivoting

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8krMUzA0UDAyMDI8tEABCSnpKMGY5maWKHyFACyK4CgAJux2aAGQGatDpCXmBqjmuRFlSQDCAkNCFhiSZQHEF7EA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Date of Inspection   " = _t, #"Job #   " = _t, #"Criteria 1   " = _t, #"Criteria 2   " = _t, #"Criteria 3   " = _t]),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"Date of Inspection   ", "Job #   "}, "Attribute", "Value")
in
    #"Unpivoted Other Columns"

That is now in a format which Power BI likes and can use for computations

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.