Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
sebHan
Contributor III
Contributor III

Creating a filter based on expression

Hey! I'm pretty new to qlik sense and I want to create a filter based on a expression.

Basically they thing I want to accomplish is a dropdown, where you can filter based on 4 condition.

I have tried creating a master dimension based on the following condition, which it also what 

If(Count([Customer])>1 and Sum({$<[Fiscal Year]={'FY 2021/22'}>}[Planlagte timer])>45, 'Overbooked',
if(Sum({$<[Fiscal Year]={'FY 2021/22'}>}[Planlagte timer])<25, 'Under 25',
if(Sum({$<[Fiscal Year]={'FY 2021/22'}>}[Planlagte timer])>45, 'Over 45', 'Standard')))

However, this comes in as an invalid dimension, when I implement it in a filter pane.

The desired result is a filter pane, in which I can choose between "Overbooked", "Under 25", "Over 45" and "Standard".
I have labelled this expression as Booking status.

Can anybody help here?

Labels (6)
1 Solution

Accepted Solutions
hic
Former Employee
Former Employee

If you want a complex expression like this, you need to put it in an Aggr(). So...

=Aggr( <YourExpressionWithAggregations>, <Dimension> )

The dimension needs to be a field and this is the field for which the aggregations are calculated and where the engine makes the selection when a user clicks in the filter pane. 

View solution in original post

3 Replies
hic
Former Employee
Former Employee

If you want a complex expression like this, you need to put it in an Aggr(). So...

=Aggr( <YourExpressionWithAggregations>, <Dimension> )

The dimension needs to be a field and this is the field for which the aggregations are calculated and where the engine makes the selection when a user clicks in the filter pane. 

sebHan
Contributor III
Contributor III
Author

Thanks for the quick answer! It makes somewhat sense, and the Dimension is no longer invalid.

I still think I fail to do it properly though - is it because I have to generate Booking status in the editor, before this works?:

=Aggr((If(count([navn])=1 and Count([Customer])>1 and Sum({$<[Fiscal Year]={'FY 2021/22'}>}[Planlagte timer])>45, 'Overbooket'),
if(Sum({$<[Fiscal Year]={'FY 2021/22'}>}[Planlagte timer])<25, 'Under 25',
if(Sum({$<[Fiscal Year]={'FY 2021/22'}>}[Planlagte timer])>45, 'Over 45', 'Standard'))), "Booking status")

hic
Former Employee
Former Employee

Yes, you need to have a clear definition of the dimension: Per what should the count([navn]) and the other aggregations be calculated?

And it usually means that you need a field that is defined in the script.