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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
rajuamet
Partner - Creator III
Partner - Creator III

Set Analysis - How to pass a field value in set analysys

Hi Techies,

Here I have two tables:

Table1:

Snapshot_MonthProducts_Aggregate
DecA,B,C,D,E
NovB,C,D
OctA,F

 

Table2:

Snapshot_MonthProductsRatingsum
DecA100
DecB200
DecC300
DecD400
DecE100
NovA100
NovB200
NovC300
NovD400
NovE100
OctA100
OctB200
OctC300
OctD400
OctE100

 

In a straight table, Snapshot_month is the dimension, Count(Products) is the expression.

Here, I need to pass Products_Aggregate via set expression to filter the products.

For example:

This is how we need the set expression.

Snapshot_MonthExpression
DecCount({$<Product={'A,B,C,D,E'}>}Product)
NovCount({$<Product={'B,C,D'}>}Product)
OctCount({$<Product={'A,F'}>}Product)

 

Required Output:

Snapshot_MonthOutput
Dec5
Nov3
Oct2

 

Please let me know how to achieve this.

Labels (2)
12 Replies
rajuamet
Partner - Creator III
Partner - Creator III
Author

Hi Pradosh,

I can not count the Product_Aggregate. Because Products count may differ in real scenario. I need to pass the Product_Aggregate set to count the Product.

Thank you.

rajuamet
Partner - Creator III
Partner - Creator III
Author

Hi Kaanerisen,

As mentioned above, I can not count the Product_Aggregate. Because Products count may differ in real scenario. I need to pass the Product_Aggregate set to count the Product.

Thank you.

kaanerisen
Creator III
Creator III

OK then how about this 🙂

COUNT(IF(WildMatch(prodAgg,product&',*','*,'&product,'*,'&product&',*',product),product))

Untitled.png

Your required output is mentioned in your post is

Snapshot_MonthOutput
Dec5
Nov3
Oct2

 

But Oct should be 1 because there is only Product A data that match in table 1 in October.

If you want to use set analysis, You should create a uniqueID for month&product.

load AutoNumber(month&'|'&product) as key,* Inline [
month,product,value
Dec,A,100
Dec,B,200
Dec,C,300
Dec,D,400
Dec,E,100
Nov,A,100
Nov,B,200
Nov,C,300
Nov,D,400
Nov,E,100
Oct,A,100
Oct,B,200
Oct,C,300
Oct,D,400
Oct,E,100
]

Count({<key={"=WildMatch(prodAgg,product&',*','*,'&product,'*,'&product&',*',product)"}>}key)

 

Hope it helps.