Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

achillespa
New Contributor

Unique count & sum

Hey

I´m new in this forum and I need your help. J

I need to get a numeric result (0,1 or 2) based on following conditions:

Field1 = Unique value

Field2= only for references that starts with 20, 40 or 45

That means:

  • if Field2 contains LCL the value in the Result column must be 0
  • if field2 contains 20 (as first 2 digits), the value in the Result column must be 1 – regardless how many duplicates are in the Field1
  • if field2 contains 40 or 45 (as first 2 digits), the value in the Result column must be 2 – regardless how many duplicates are in the Field1

forum.PNG

  Can you help me=?

Thank you

2 Replies
consultant_bi
Contributor

Re: Unique count & sum

hello,

try this one on the formula expression of the field result:


=if(wildmatch(field2,'LCL'),'0',

if(wildmatch(field2,'20*'),'1',

if(wildmatch(field2,'40*'),'2',

if(wildmatch(field2,'45*'),'2'))))

Sans titre.png

robert99
Valued Contributor II

Re: Unique count & sum

This should work too

=if(wildmatch(field2,'LCL'),'0',

if(wildmatch(field2,'20*'),'1',

if(wildmatch(field2,'40*','45*'),'2',

)))