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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Help with embedded if statement

Hey,

Can anyone help me with this? for some reason it won't pull in the 'Billable', and I am thinking it is something to do with the dash. The Bus Dev and the Non- Bus Dev are working fine.

if(left(AccountNumber,7)= '-', 'Billable',if(left(AccountNumber,2) = '56', 'Business Development'), 'Non-Business Development')) as [Expense Type]

5 Replies
m_woolf
Master II
Master II

left(AccountNumber,7)  will return the first 7 chartacters at the left of the AccountNumber field.

The first 7 characters can't be equal to "-"

Anonymous
Not applicable
Author

is the dash in the field or does it represent a null field

if it represents a null try

if(len(left(AccountNumber,7))>0, 'Billable',if(left(AccountNumber,2) = '56', 'Business Development', 'Non-Business Development')) as [Expense Type]

if the dash is the correct character then you have an extra close bracket

if(left(AccountNumber,7)= '-', 'Billable',if(left(AccountNumber,2) = '56', 'Business Development', 'Non-Business Development')) as [Expense Type]

hope this helps

Anonymous
Not applicable
Author

Hi,

you should use mid functions and not left.

In your example if(AccountNumber,7,1)='-' ...

Regards.

Not applicable
Author

Makes Sense, but I am trying to pull the first 6 characters as 'Billable' and the account number is 012345-0444.

MarcoWedel

If(Mid(AccountNumber,7,1)='-' ...