Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
livio218526
Creator
Creator

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

14 Replies
sunny_talwar

Where exactly are you trying to use the if statement? I am not sure I understand

livio218526
Creator
Creator
Author

In a variable, I want save the value in a variable

sunny_talwar

I am not sure I am following your requirement... can you elaborate?

livio218526
Creator
Creator
Author

I have a field with value like: ACT,FC 1, Fc 2, BDG, ....

I want save the value in a variable with this conditions:

  • 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".
  • if SCENARIO is equal to ACT, BDG or other, i want the value (no filter).
sasiparupudi1
Master III
Master III

Like this?

T1:

Load

SCENARIO,

If(SubStringCount(Lower(SCENARIO),'fc 1') AND SubStringCount(Lower(SCENARIO),'fc 2') AND SubStringCount(Lower(SCENARIO),'fc 3'),'FC 3',

  If(SubStringCount(Lower(SCENARIO),'fc 1') AND SubStringCount(Lower(SCENARIO),'fc 2'),'FC 2',

    If(SubStringCount(Lower(SCENARIO),'fc 1'),'FC 1'

    ))) AS [New Scenario]

inline

[

SCENARIO

Fc 1,Fc 2,FC 3

FC 1, fC 2,ABD,EGF

Fc 3,

Fc 1,

FC 24

](delimiter is '|');