Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

kumarkp412
Contributor II

Conditional filter in Qliksense

Dear All,

I want to create a filter called branch and it should show the names as per the current year how many branches are there .

When i try to create a condition filter, it was throw me an error and it says as invalid dimension.

for I uses as

only({<year='2017'>}branch).

I was strucks here .Can you one help on this , it would be appreciated.

Thanks in advance

Thanks

Kumar KVP

1 Solution

Accepted Solutions
MVP
MVP

Re: Conditional filter in Qliksense

May be try this

If(year = 2017, branch)

or this

Aggr(Only({1<year = {2017}>} branch), branch)

8 Replies
MVP
MVP

Re: Conditional filter in Qliksense

May be try this

If(year = 2017, branch)

or this

Aggr(Only({1<year = {2017}>} branch), branch)

shraddha_g
Honored Contributor III

Re: Conditional filter in Qliksense

Try

Only({<year = {'2017'}>}branch)

mark6505
Valued Contributor III

Re: Conditional filter in Qliksense

HI

I think the first suggestion by Sunny has suggested is what your looking for.

IF(year=2017, branch)

Only() function is used when your set analysis will only ever return a single value, the error is occurring as you will have multiple branches in your data with the year of 2017, so it doesn't know which one to return.

Mark

sureshqv
Esteemed Contributor III

Re: Conditional filter in Qliksense

try like this

aggr(Only({<year = {'2017'}>}branch),branch)

kumarkp412
Contributor II

Re: Conditional filter in Qliksense

Hi Sunny,

Thanks for your reply.

I tried with the if condition what you mentioned. It was selecting entire data as 2017. I didnt need this.

I want only this branch filter should show the current year possible value of branches in it.

Also when i try with having the only function it was throw as invalid error.

Thanks in advance

Thanks

Kumar KVP

shraddha_g
Honored Contributor III

Re: Conditional filter in Qliksense

Share sample app

Solutions provided by Sunny should work..

martinpohl
Valued Contributor II

Re: Conditional filter in Qliksense

you need to calculate the condition for each value, so aggr is needed.

use

=aggr(only({1<year={'2017'}>}branch),branch)

Regards

kumarkp412
Contributor II

Re: Conditional filter in Qliksense

Thanks Sunny,

It was working fine when i uses the second expression.

Thanks

Kumar KVP