Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
mustafaelryah
Creator
Creator

using left statement

Dear All,

     I need to sort my account column , example : 1101  , this is asset account because the first left digit is one  , and 6021 is expense account because the first digit is 6, I used the below statement but I got an error :

if(Left("account",1) = 'asset') as "Account_Type" ,

//or ..

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

QV field names are case sensitive - is the field name Account or account?.

As for your expression, based on your description, this what you need:

     If(Left(account, 1) = '1', 'asset', If(Left(account, 1) = '6', 'expense', 'other')) As Account_Type,

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

4 Replies
its_anandrjs

Hi,

Can you elaborate with an example

or you can try

if(Left("account",5) = 'asset') as "Account_Type"

Because the account has 5 words let me know

Regards

Anand

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

QV field names are case sensitive - is the field name Account or account?.

As for your expression, based on your description, this what you need:

     If(Left(account, 1) = '1', 'asset', If(Left(account, 1) = '6', 'expense', 'other')) As Account_Type,

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Anonymous
Not applicable

Hello,

use this

if(Left(account,1)=1, 'asset',if(Left(account,1)=6,'expense','N/A')) as account_type


HTH

mustafaelryah
Creator
Creator
Author

All correct answers , Thanks All ^_^,