Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Welcome to our newly redesigned Qlik Community! Read our blog to learn about all the new updates: READ BLOG and REPORTED ISSUES
cancel
Showing results for 
Search instead for 
Did you mean: 
Contributor III
Contributor III

How to create a derived column in load script editor based on multiple columns

I'm trying to create a new column "report_type" by referencing 3 different columns.  I tried using the wildmatch function, but did not work (see script below).

Each of the columns I'm referencing (kpi, aib, cancellation) have values of either 0 or 1 (binary).


Load
Text(kpi) as kpi,
Text(aib) as aib,
Text(cancellation) as cancellation,
if(WildMatch(kpi,'1'), 'KPIs',
if(WildMatch(aib,'1'), 'AIB',
if(WildMatch(cancellation,'1'), 'Cancellations'))) as report_type,

2 Replies
Partner
Partner

I don't think you need the wildmatch.  Check the value of the fields as Qlik sees them, but generally binary fields will show as 0, 1  or possibly -1.  Then just do the direct comparison.  Also, I like to indent my nested 'ifs' to make it easier to follow:

if(kpi,='1',
   'KPIs',
   if(aib='1',
      'AIB',

      if(cancellation='1',
         'Cancellations',
         'Other'
         )
      )
   ) as report_type,

 

Contributor III
Contributor III

I figured out my logic would not work as there could be more than 1 columns with a value of 1.  Thanks for the help anyway!