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

Announcements
Learn how to migrate to Qlik Cloud Analytics™: On-Demand Briefing!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Analyze the combination of values

Dear Qlikview-Community,

I'm struggeling with the problem following and would appreciate your help:

I've got one Table:

SALES

----------

Sales Order Number

Product

Product Variant

The Field Variant has is a string of many comma-separated values.

EXAMPLE:

Sales Order Number: 101010000

Product: PPP2

Product Variant: X1,Y5,K4

How could I make a table of all these combinations?

Creating a table with hundreds of columns does not make sense. Does it?

Every column should have a function like [Code] substringcount([Product Variant]),'X1') [/Code]

How could I solve this?

Thank you very much for your help.

5 Replies
Not applicable
Author

Hi,

try to use Subfield() function. For example:

LOAD
[Sales Order Number],
Product,
[Product Variant],
Subfield([Product Variant], ',') AS Variant
FROM ....

So instead of this table:

OrderProductProduct variant
101010000PPP1X1,Y5,K4


u will get something like this:

OrderProductVariant
101010000PPP1X1
101010000PPP1Y5
101010000PPP1K4


Milda

Not applicable
Author

Dear Milda,

thank you very much for your help.

I already have done this. Exactly how you recommended.

The question is, to count how many Variants a Product has in all Orders.

Meaning: I need to know how many times appears a combination of X1 and Y5 for instance.

If I would do this in a pivot table by making hundreds of columns.

johnw
Champion III
Champion III

So for this data:

Order Product Variant
1 A X1, Y5, K4
2 A X2
3 A Y4, Y5
4 A Y5, K4, K5
5 B X1, X2, Y4, Z7, Z2

You want to, say, select product A, and see a table like this?

X1 X2 Y4 Y5 K4 K5
X1 1 0 0 1 1 0
X2 0 1 0 0 0 0
Y4 0 0 1 1 0 0
Y5 1 0 1 3 2 1
K4 1 0 0 2 2 1
K5 0 0 0 1 1 1

I'm just confirming the requirement. If that's what you want, I've poked at it before, but wasn't able to solve it.

Not applicable
Author

Yes John, that's exactly what I'm searching for.

johnw
Champion III
Champion III

OK, I'm not sure how well this will scale up to a full size application, but one way is to create a second table with Order and a duplicate Variant field. Create a pivot table with the two variants as dimensions, and count(distinct Order). See attached.