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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
fsilva1
Contributor II
Contributor II

if conditional to ignore a field

Hi guys,

I have a pivot table where the column is Product.
This pivot only shows products that belong to Category A.
A second pivot table displays only products from Category B.

When a user selects a product from the first pivot (Category A), a variable is set to check if the selected product exists in the list of Category A products.

 

  • If the selected product is in Category A, the column Value should display the value for that product.

  • If the selected product is not in Category A (i.e., from Category B), then all products from Category A should be displayed, ignoring the selection, because the user might have clicked a product from the second pivot (Category B).

I created an IF condition to handle this logic.

However, when I select a product from Category B, the Value column in the first pivot becomes empty or null — nothing is shown.

What is wrong with this IF condition?
Why is the column not showing values when selecting a product from Category B?
How can I fix this logic so that the column still shows all Category A products in that case?

 

if(

 WildMatch(vListProducts,''& [Products] &'')>0, pick(WildMatch(vListProducts,''& [Products] &''), Only({<[Category]={'A'}>} [Value]), Only({<[Produtcs],[Category]={'A'}>} [Value]) ),Only({<Products, [Category]={'A'}>} [Value]))




 

Labels (4)
1 Reply
SRA
Partner - Creator
Partner - Creator

Hi,

You can maybe do something with "Alternate states".

Let's assume we have these data load :

Source:
LOAD * INLINE [
Product, Category, Value
P1, A, 100
P2, B, 200
P3, A, 150
P4, B, 250
P5, A, 400
P6, B, 600
]
;

Let's create 2 pivot tables with Product and value sum with a set analysis on category :

SRA_0-1744615875130.png

In master items, you can create 2 alternate states 'Category A' & 'Category B' for exemple :

SRA_1-1744615969997.png

Then, in he pivot table paramters "Appearance / Alternate states" you can select the corresponding alternate state. Do so for the 2 pivot tables.

SRA_2-1744616055282.png

One this done, you can select independently products from Category A or Category B without impacting the other pivot table.

SRA_3-1744616174026.png

Let me know if this solution fits to your requirement. If yes, tick it a a solution.

Regards

SRA