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: 
gauthamchilled
Creator
Creator

how to simplify this if statement

hi all

i have this condition, regardless of revenue if profit is positive number i have to show +ve margin otherwise negative number

how can I achieve this?

if sum(profit) < 0 and sum(revenue) < 0, -(sum(profit)/sum(revenue)

if sum(profit) < 0 and sum(revenue) > 0, -(sum(profit)/sum(revenue)

if sum(profit)> 0 and sum(revenue) < 0, (sum(profit)/sum(revenue)

if sum(profit)> 0 and sum(revenue) > 0, (sum(profit)/sum(revenue)

can you simplify the above if statement?

Regards

Gautham

10 Replies
Anil_Babu_Samineni

May be this?

if(RangeSum(profit, revenue) < 0, -RangeSum(profit,revenue),

if(sum(profit) < 0 and sum(revenue) > 0, -RangeSum(profit, revenue)

if(sum(profit)> 0 and sum(revenue) < 0, RangeSum(profit,revenue)

if( RangeSum(profit, revenue) > 0, RangeSum(profit,revenue)))))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful