Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

measure

Hi All,

Can anyone help me with the conversion of below if loop to case statement. I want to use the below logic in the select statement.

if(MATCH_TYPE = 'VOD','Tier 1', 

  if(MATCH_TYPE <> 'VOD' AND Match(NETWORK_TYPE,'Broadcast', 'Cable') AND Len(Trim(PROGRAM_NAME)) <> 0, 

      if((TIMESHIFT_INDICATOR_ID >= 10 AND TIMESHIFT_INDICATOR_ID <= 16) And SAMPLE <> 0, 

            'Tier 2','Tier 1'))) 

As Field_Name

1 Solution

Accepted Solutions

Re: Script for a measure

Something like this:

LOAD    

     If(MATCH='VOD', 'Tier 1',

          If(NOT Match(NETWORK_TYPE,'Broadcast','Cable') AND NOT IsNull(program),

               If(Num#(Left(TIMESHIFT_DESC,2)) >= 8 AND Num(Left(TIMESHIFT_DESC,2)) <=14

                 AND Count(Distinct USERS_META_ID)<>0,'Tier 2','Tier 1')

          )

     ) as MyField,

     ...other fields...

FROM

     MyTable

GROUP BY

     MATCH,

     NETWORK_TYPE,

     program,

     TIMESHIFT_DESC,

     ...other fields....

     ;


talk is cheap, supply exceeds demand
2 Replies

Re: Script for a measure

Something like this:

LOAD    

     If(MATCH='VOD', 'Tier 1',

          If(NOT Match(NETWORK_TYPE,'Broadcast','Cable') AND NOT IsNull(program),

               If(Num#(Left(TIMESHIFT_DESC,2)) >= 8 AND Num(Left(TIMESHIFT_DESC,2)) <=14

                 AND Count(Distinct USERS_META_ID)<>0,'Tier 2','Tier 1')

          )

     ) as MyField,

     ...other fields...

FROM

     MyTable

GROUP BY

     MATCH,

     NETWORK_TYPE,

     program,

     TIMESHIFT_DESC,

     ...other fields....

     ;


talk is cheap, supply exceeds demand
sureshqv
Esteemed Contributor III

Re: measure

ravi,

chk dis link

switch control statement

Community Browser