Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
SchEy
Contributor
Contributor

Filter a product dimension on multiple criteria AND conditions

Hey,

I am new to scripting with Qlik Sense and it seems like I got an Syntax error ( Expression error: ')' expected) on following:

An extract of the required metadata could be described like:

LV1LV2LV3
Group 1letterA
Group 1letterB
Group 1letterC
Group 1letterD
Group 1number1
Group 1number2

 

I want to create a table that involes A, B and C in the rows. Nothing else. And I (because of more complex metadata issues) I have to put a filter on "letter" in Lv 2.

 

This is my formula: 

=if([Lv2]={'letter'} and [Lv3]={'A','B','C'},[LV3])
 
 
It has to be the [Lv3]={'A','B','C'} because when I am pasting the formula block by block, here the error comes up...
 
Anyone who may help? Thank you!
 
 
Labels (2)
1 Solution

Accepted Solutions
Nicole-Smith

You're mixing set analysis syntax with if statement syntax.

Proper if statement syntax:
if([Lv2] = 'letter' and match([Lv3], 'A', 'B', 'C'), [LV3])

Or if you want set analysis, it needs to go inside of some type of aggregation function:
only({<[Lv2]={'letter'}, [Lv3]={'A','B','C'}>} [LV3])

The former can be used as a dimension, but the latter will work as measure and not dimension.

View solution in original post

1 Reply
Nicole-Smith

You're mixing set analysis syntax with if statement syntax.

Proper if statement syntax:
if([Lv2] = 'letter' and match([Lv3], 'A', 'B', 'C'), [LV3])

Or if you want set analysis, it needs to go inside of some type of aggregation function:
only({<[Lv2]={'letter'}, [Lv3]={'A','B','C'}>} [LV3])

The former can be used as a dimension, but the latter will work as measure and not dimension.