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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
priyav24
Creator II
Creator II

How to split the expression based on a condition?

Hello Everybody,

    I Have a requriment that the expression Sum(voucheramount) should be splitted into two expression like one should contain all the negative values as credit and the other one should contain Positive Values as Debit..

Thanks in Advance,

Priya

1 Solution

Accepted Solutions
er_mohit
Master II
Master II

sum(if(voucheramount<0,voucheramount,null())) // for credit

sum(if(voucheramount>=0,voucheramount,null())) //Debit

make sure in peresentation tab check on suppress null value


View solution in original post

5 Replies
tresesco
MVP
MVP

Better do it in the script like this:

Load

         If(voucheramount<0, voucheramount) as Credit,

          If(voucheramount>=0, voucheramount) as Debit

From ....;

er_mohit
Master II
Master II

sum(if(voucheramount<0,voucheramount,null())) // for credit

sum(if(voucheramount>=0,voucheramount,null())) //Debit

make sure in peresentation tab check on suppress null value


priyav24
Creator II
Creator II
Author

Hi tresesco,

                 At the moment i could not reload ..Is there any other way to do it

Thanks,

Priya

priyav24
Creator II
Creator II
Author

Thanks Mohit ..

tresesco
MVP
MVP

Then use Sum( If()) as suggested by Mohit if you are only looking for the Sum.