2 Replies Latest reply: Jun 13, 2017 5:25 AM by Supriya R RSS

    Count with where condition in qlik

    Supriya R

      Hi,

       

      i have a below code

       

      LatestExpiredCampaignTable:

      LOAD

      MAX(expiration_date) as expiration_date,

      '1' as expFlag,

      batch_meta_data_id,

      1 as last_batch

      Resident MainTable

      where expFlag = 1

      Group By batch_meta_data_id;

       

       

      Load expiration_date,

      batch_meta_data_id,

      expFlag,

      last_batch,

      count(DISTINCT expiration_date) as count_value

      resident LatestExpiredCampaignTable  where expFlag = 1 and last_batch = 1

      Group By batch_meta_data_id;

      drop Table LatestExpiredCampaignTable;

       

      In above code i am trying to get count of expired_date i.e count_value, then i want to check like

      if(count_value >= 2)

      /* Here i want to load only rows with expFlag = 0 */

      else

      /* i want to load all rows with expFlag = 1 or last_batch = 1*/

      endif


      But green colored above code gives me invalid expression. What i am missing here and how to load data according to if else condition.