Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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

1 Solution

Accepted Solutions
consultant_bi
Creator
Creator

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

View solution in original post

2 Replies
consultant_bi
Creator
Creator

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
Specialist III
Specialist III

This should work too

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

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

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

)))