Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

livio218526
Contributor

if with multiple value of field

Hello to all,

I have a problem.

I have a field called SCENARIO and I would like to save the value of this in a variable, but according to the following condition:

  • If the SCENARIO field contains the following values "FC 1" and "FC 2" and "FC 3" then I want the variable to contain only the value "FC 3".
  • If the SCENARIO field contains the following values "FC 1" and "FC 2" then I want the variable to contain only the value "FC 2".
  • If the SCENARIO field only contains "FC 1" then I want the variable to contain only the value "FC 1".

I tried with an if but without success.

Thank you,

Livio

Tags (3)
14 Replies
MVP
MVP

Re: if with multiple value of field

Where are you going to be using this? On the front end? May be this

MaxString(SCENARIO)

livio218526
Contributor

Re: if with multiple value of field

Front end, but in the field SCENARIO, I have other value, so i think that MaxString(SCENARIO) not working in my case.

pooja_prabhu_n
Contributor III

Re: if with multiple value of field

Hi,

Try using =MaxString(SCENARIO)

Thanks,

Pooja

MVP
MVP

Re: if with multiple value of field

May be like this

If(SubStringCount(Concat(DISTINCT '|' & SCENARIO & '|'), '|FC 3|) = 1, 'FC 3',

     If(SubStringCount(Concat(DISTINCT '|' & SCENARIO & '|'), '|FC 2|) = 1, 'FC 2',

          If(SubStringCount(Concat(DISTINCT '|' & SCENARIO & '|'), '|FC 1|) = 1, 'FC 1')))

livio218526
Contributor

Re: if with multiple value of field

Not working again

MVP
MVP

Re: if with multiple value of field

My bad, I missed single quotes

If(SubStringCount(Concat(DISTINCT '|' & SCENARIO & '|'), '|FC 3|') = 1, 'FC 3',

     If(SubStringCount(Concat(DISTINCT '|' & SCENARIO & '|'), '|FC 2|') = 1, 'FC 2',

          If(SubStringCount(Concat(DISTINCT '|' & SCENARIO & '|'), '|FC 1|') = 1, 'FC 1')))

livio218526
Contributor

Re: if with multiple value of field

I know, I corrected it but not working too

MVP
MVP

Re: if with multiple value of field

Would you be able to share a sample or image of where you are using this?

livio218526
Contributor

Re: if with multiple value of field

Capture.JPG

Community Browser