Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join us at the Cloud Data and Analytics Tour! REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
paisleymike
Contributor III
Contributor III

How to set and use a variable in an expression

Hello

In Qlik Sense I was looking to make a dimension which allows filtering by the lowest 20%, middle 60% and the Highest 20%

so my expression was

=

If(overcrowded_rate <= $(=Max(overcrowded_rate)/100*20), 'Lowest 20%',

If(overcrowded_rate < $(=Max(overcrowded_rate)/100*80), 'Middle 60%',

If(overcrowded_rate >= $(=Max(overcrowded_rate)/100*80), 'Highest 20%',

null())))

But when i use this the filtering is allowed but you can filter for the middle 60% of the middle 60%

Can this expression be changed so that it only can be applied once

Thank you

2 Replies
Anil_Babu_Samineni

How about this?

If(overcrowded_rate <= Max(TOTAL overcrowded_rate)/100*20, 'Lowest 20%',

If(overcrowded_rate < Max(TOTAL overcrowded_rate)/100*80, 'Middle 60%',

If(overcrowded_rate >= Max(TOTAL overcrowded_rate)/100*80), 'Highest 20%',

null())))

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
sunny_talwar

May be try this

If(Only({<overcrowded_rate>} overcrowded_rate) <= (Max({<overcrowded_rate>} TOTAL overcrowded_rate)/100*20), 'Lowest 20%',

If(Only({<overcrowded_rate>} overcrowded_rate) < (Max({<overcrowded_rate>} TOTAL overcrowded_rate)/100*80), 'Middle 60%',

If(Only({<overcrowded_rate>} overcrowded_rate) >= (Max({<overcrowded_rate>} TOTAL overcrowded_rate)/100*80), 'Highest 20%',

Null())))

Or this

If(Only({1} overcrowded_rate) <= (Max({1} TOTAL overcrowded_rate)/100*20), 'Lowest 20%',

If(Only({1} overcrowded_rate) < (Max({1} TOTAL overcrowded_rate)/100*80), 'Middle 60%',

If(Only({1} overcrowded_rate) >= (Max({1} TOTAL overcrowded_rate)/100*80), 'Highest 20%',

Null())))