Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Support Case Portal has moved to Qlik Community! Read the FAQs to start exploring Support resources.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Need clarification on if condition with two fields

hi friends

please help me on this requirement

IF(

    MTD Contact =  Manager   

    )

THEN

    (WHEN data= MDS, Contact Name = “Juli ”

    WHEN data= MIS, Contact Name = “Test”

    WHEN data=  Pharma, Contact Name = “peenot”

    WHEN data= Corporate, Contact Name = “trisha “ )

ELSE IF(

    MTD Contact = Solution Manager

    )

THEN

    (Contact Name = solution_manager_name)

ELSE IF(

    MTD Contact = Project Manager

    )

THEN

    (Contact Name = project_manager)

Note:here MTD Contact and data is two field names and i have to derive a new field called Contact Name

please give if condition in qlikview

Thanks,

Siddik

2 Replies
swuehl
MVP
MVP

Maybe something along these lines

LOAD

     [MTD Contact],

     [data],

     IF(  [MTD Contact] =  'Manager',

          Pick(Match(data,'MDS','MIS','Pharma','Corporate'),'Juli','Test','peenot','trisha'),

          If([MTD Contact] =  'Solution Manager', 'solution_manager_name', // or is this a field? Don't know..

               If([MTD Contact] =  'Project Manager', 'project manager')

          )

     )    

               AS [Contact Name],

     ...

FROM ...;

sunny_talwar

Another option would be to use Mapping Load. I am loading the data using Inline load, but you can maintain this data in an excel file. This makes the maintenance of the data slightly easier compared to if statement.

MappingTable:

Mapping

LOAD [MTD Contact]&'|'&data as Field1,

  Mapped;

LOAD * Inline [

MTD Contact, data, Mapped

Manager, MDS, Juli

Manager, MIS, Test

Manager, Pharma, peenot

Manager, Corporate, trisha

Solution Manager, , solution_manager_name

Project Manager, , project_manager

];

FactTable:

LOAD [MTD Contact],

  data,

ApplyMap('MappingTable', [MTD Contact]&'|' &If([MTD Contact] = 'Manager', data)) as [Contact Name],

  sales;

LOAD * Inline [

MTD Contact, data, sales

Manager, MDS, 100

Solution Manager, xyz, 400

Project Manager, ysh, 320

Manager, MIS, 672

Manager, Pharma, 392

Manager, Corporate, 832

];


Capture.PNG