Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
phoenix
Creator
Creator

Create freq for each combination of attributes and calculate percentages of BAD var

Hello,

I was working on the below dataset sometime back and johnw‌ has helped me develop a frequency and percentage matrix for the dual combination of these attributes. original post here: Create frequency count crosstab matrix and for each combination calculate percentages of target var

copying the content from original post here:

I have the following dataset

ID   attribute1   attribute2   attribute3     BAD (Y-> yes)
1        1               0               0                 Y
2        1               1               0                 N
3        1               0               1                 Y
4        0               1               1                 N
5        1               1               0                 Y
6        1               1               0                 N
7        1               0               1                 Y
8        1               0               1                 N

I want to create frequency count matrix, for each combination of attribute tripped (atrribute = 1 means tripped) like following:

                          attribute1    attribute2    attribute3
attribute1                  _                3                  3
attribute2                 3                 _                 1
attribute3                 3                 1                  _

It represents counts of attributes tripped together.

Once i have the counts I need to calcualte %BAD in each combination like below.


                      attribute1     attribute2     attribute3
attribute1             _               12.50%         25%
attribute2        12.50%             _                   0%
attribute3            25%              0%                _

it represents out of 3 ID's for the combination atribute1 and atribute2 tripped, one ID went BAD -> so 12.5% BAD

And out of 3 ID's for the combination attribute1 and attribute1 tripped, two went BAD -> so 25% BAD

And the 1 ID for the combination attribute2 and attribute3 tripped, didnt went BAD -> so 0% BAD

Currently I am trying to do this in a report/table layout rather than a matrix layout for every possible combination of the attributes. I have the below dataset.

My dataset look like this:

   

ID 

gradetypescore rangeattribute1 attribute2attribute3attribute4attribute5BAD (Y-yes/N- No)
1       A1100-1101              0              0                1              0              Y
2       A1120-1301              1              0                1              1              N
10A1100-11010010N
3       B270-801              0              1                1              0              Y
4       C330-400              1              1                0              1              N
5       A340-501              1              0                1              1              Y
6       B480-901              1              0                1              1              N
7       C240-501              0              1                1              0              Y
8 C430-401              0              1                1              0              N

 

Report I'm trying to build: Goal is to build this report to show frequencies and also percentages.

A1A2A3A4A5A1, A2A1, A3A1, A4A1, A5A2, A3A2, A4A2, A5A3, A4A3, A5A4, A5A1, A2, A3A1, A2, A4A1, A2, A5A1, A3, A4A1, A3, A5,A1, A4, A5A1, A2, A3, A4A1, A2, A4, A5A1, A3, A4, A5A1, A2, A3, A4, A5
BADgradescore range
yesA100-1101 1 1
110-120
120-13011 111 11 11 1 11 1 1
B90-100
80-90
70-80
C40-50
30-40
NoA100-110 212211
110-120
120-130
B90-100
80-90
70-80
C40-50
30-40

Thanks

0 Replies