Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Now accepting applications for the Qlik Luminary and Partner Ambassador Programs: Apply by July 6!
cancel
Showing results for 
Search instead for 
Did you mean: 
Dan_A
Contributor
Contributor

Counting similar values across multiple fields

Hi,

I need to count up multiple values across several different fields:

User Colour A Colour B Colour C Colour D
James GREEN BLUE - GREEN
Charlotte BLUE GREEN BLUE -
Neil YELLOW YELLOW YELLOW BLUE
Lauren GREEN BLUE - YELLOW
Sarah YELLOW YELLOW YELLOW -

 

I need to see how often each value is used, so that the values become the dimensions:

YELLOW 7
GREEN 4
BLUE 5

Dan_A_0-1733388917509.png

I also need to be able to filter at User level, so filtering on James would show

YELLOW -
GREEN 2
BLUE 1

 

I hope this makes sense, thanks!!

Labels (1)
3 Replies
henrikalmen
Specialist II
Specialist II

Flatten the table in backend. Something like:

new_table:
load User, [Colour A] as Colour resident old_table where len([Colour A])>0;
concatenate load User, [Colour B] as Colour resident old_table where len([Colour B])>0;
concatenate load User, [Colour C] as Colour resident old_table where len([Colour C])>0;
concatenate load User, [Colour D] as Colour resident old_table where len([Colour D])>0;

From this new table you can count colours per User.

Kushal_Chawda
MVP
MVP

henrikalmen
Specialist II
Specialist II

Yes, crosstable is even better (slightly more advanced but especially if
there are many columns it's a better option).