Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
kdsonntag
Contributor
Contributor

Categorizing Fields

I am working to develop a pie chart and need to categorize or group text data and change the labels for the chart.

The data is as below

Zip Codes         Needs to be displayed as

99999                 On Street

77777                 Shelter

66666                 Shelter

all others          Not Homeless

Dimension:??????

Expr: count(DISTINCT [Client ID])

 

Should return a pie chart with three sections: On Street, Shelter, Not Homeless

 

Tried this dimension, getting error:

=Aggr(If(Client.ZipCode NE=99999, 'On Street',
if(client.zipcode ne= 66666 or 77777, 'Shelter', 'Not Homeless')))

1 Solution

Accepted Solutions
hopkinsc
Partner - Specialist III
Partner - Specialist III

OK, well this is what i have done.. 

Dimension:

=If([Zip Codes]='99999', 'On Street',
if([Zip Codes]='77777' or [Zip Codes]='66666', 'Shelter',
'Not Homeless'
))

Expression:

count(DISTINCT [Client ID])

 

obviously you have to change the field names to match yours.

But the above works for me as you can see..

 

Capture.JPG

View solution in original post

5 Replies
hopkinsc
Partner - Specialist III
Partner - Specialist III

You should do this in the script and use a mapping table. 

If you need to do it in the chart though you can use an IF statement in the dimension

=if([Zip Codes] = '99999','Homeless',

    if([Zip Codes] = '77777', or [Zip Codes] = '66666','Shelter',

     'Not Homeless'

))

 

try that

 

 

 

kdsonntag
Contributor
Contributor
Author

still getting error.  Unfortunately I do not have access to add any tables. I only have access to the front end so that I can build and edit tables and charts.

hopkinsc
Partner - Specialist III
Partner - Specialist III

Here is a sample.. 

kdsonntag
Contributor
Contributor
Author

Sorry, I can't open this file. I only have access to the end-user web-based interface provided by a 3rd party vendor. I cannot open qlik files. 

hopkinsc
Partner - Specialist III
Partner - Specialist III

OK, well this is what i have done.. 

Dimension:

=If([Zip Codes]='99999', 'On Street',
if([Zip Codes]='77777' or [Zip Codes]='66666', 'Shelter',
'Not Homeless'
))

Expression:

count(DISTINCT [Client ID])

 

obviously you have to change the field names to match yours.

But the above works for me as you can see..

 

Capture.JPG