Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

If statement in Load

Hi,

I'm trying to get this line to work in a load statement for a new table.

PerformanceData:

  Load

  [TestId],

  IF ([Site Type] ='ICMP', ([Mean Frame Loss]*2) AS [Mean Packet Loss], [Mean Frame Loss] AS [Mean Packet Loss])

  Resident [TestData]


The fields are in two tables:

    Site:

    Load

    [TestId]

    [Site Type],

    FROM [Combo.qvd] (QVD)

    ;

  TestData:

  Load

  [TestId],

  [Mean Frame Loss],

  FROM [Combo.qvd] (QVD)

    ;

So if the Site Type is ICMP, then the Mean Frame Loss should be doubled and put into the Mean Packet Loss Field, otherwise the Mean Frame loss should be put into the Mean packet loss field unchanged.

1 Solution

Accepted Solutions
MVP
MVP

Re: If statement in Load

May be like this:

MappingTable:

Mapping

LOAD [TestId]

    [Site Type]

Resident Site;

PerformanceData:

LOAD [TestId],

  If(ApplyMap('MappingTable', [TestId]) = 'ICMP', ([Mean Frame Loss]*2), [Mean Frame Loss]) as [Mean Packet Loss])

Resident [TestData];

4 Replies
MVP
MVP

Re: If statement in Load

May be like this:

MappingTable:

Mapping

LOAD [TestId]

    [Site Type]

Resident Site;

PerformanceData:

LOAD [TestId],

  If(ApplyMap('MappingTable', [TestId]) = 'ICMP', ([Mean Frame Loss]*2), [Mean Frame Loss]) as [Mean Packet Loss])

Resident [TestData];

Re: If statement in Load

You'll have to join the tables first if you want to do a calculation using fields from both tables. You join the tables and then calculate the result in the new joined table.

Not applicable

Re: If statement in Load

Thanks again, worked a treat.

Not applicable

Re: If statement in Load

Thanks, Sunny's solution worked without me having to do a table join so I didn't try this.