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

Aggregated Products per Customer ID

Hi i have loaded some data through SQL editor.

I have created a table in Qlik where i have these columns:

- Customer ID

- Product Category

- Count (Product Category)

I WANT TO CREATE  A COLUMN THAT SUM PRODUCTS PER CUSTOMER ID

SO THAT THE PICTURE I HAVE ATTACHED SHOULD SHOW THAT CUSTOMER ID 123 = 5

Wolfmeyn_0-1713170815014.png

 

 

Labels (1)
1 Solution

Accepted Solutions
hic
Former Employee
Former Employee

If you have both Customer ID and Product Category as dimensions in the chart, you can use the following to calculate number of product categories:

Count(total <[Customer ID]> [Product Category])

But it is simpler if you just have Customer ID as dimension. Then 

Count([Product Category])

will work.

View solution in original post

2 Replies
MATC
Contributor III
Contributor III

You can either add this to your script and use "Summary" dimension

tmp:
Load * Inline
[
CustomerID, ProductCategory
123, 'ab'
123, 'ab'
123, 'ac'
123, 'ac'
123, 'ac'
125, 'ac'
145, 'ad'
145, 'ad'
];

left join (tmp)
load
count(ProductCategory ) as Summary,
CustomerID
Resident tmp
group by CustomerID;

or add this to your table in the front as dimension as well

=aggr(count(ProductCategory),CustomerID)

hic
Former Employee
Former Employee

If you have both Customer ID and Product Category as dimensions in the chart, you can use the following to calculate number of product categories:

Count(total <[Customer ID]> [Product Category])

But it is simpler if you just have Customer ID as dimension. Then 

Count([Product Category])

will work.