Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

IF FUNCTION

Hi!

This expression returns SALES for only D instances, and i would want both C and D.

= SUM(IF(LEFT([FIELDNAME],1) = 'C','D', (SALES)))

Thanks

Labels (1)
3 Replies
er_mohit
Master II
Master II

try this

= SUM(IF(LEFT([FIELDNAME],1) = 'C' or LEFT([FIELDNAME],1)='D', (SALES)))

or

= SUM(IF(LEFT(wildmatch([FIELDNAME],'C','D'),1) , SALES))


Anonymous
Not applicable
Author

We can simplify it a little:

SUM(IF(wildmatch([FIELDNAME],'C*','D*'), SALES))

VishalWaghole
Specialist II
Specialist II

Hi

Try this

SUM(IF(match(LEFT([FIELDNAME],1),'C','D'), SALES))

or

SUM(IF(wildmatch([FIELDNAME],'C*','D*'), SALES))

Thanks