Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
BI & Data Trends 2021. Discover the top 10 trends emerging in today. Join us on Dec. 8th REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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
Highlighted
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,

 

Highlighted
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!