Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
dching
Contributor II
Contributor II

sum if mutiple conditions

Hi Guys am struggling with this expression

what i want to acheive: If Order is 3 then sum of sales of order number 2 divide by sum of sales of order number 1 * 100 as i want it in % else sumofsales)

am using this code below which is not returning anything

IF([order] = '3',
SUM({<[order] ={'2'}>} [salessum]) / SUM({<[order] ={'1'}>} [salessum])*100
,[sumofsales]
)

in summary sum of order 2 = 250/sum of order 1 = 500 = 50%  - intended result

How can I can get this to work ? thanks in advance

2 Replies
Anil_Babu_Samineni

@dching Perhaps this adding percentile.

IF([order] = '3',
Num((SUM({<[order] ={'2'}>} [salessum]) / SUM({<[order] ={'1'}>} [salessum]))*100, '#,#0%')
,[sumofsales]
)

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
marksouzacosta

Hi @dching,

That looks like something I would move to the Load Script instead of trying to solve on the charts.
Can you please share with us your Load Script and the chart you are trying to build?

Read more at Data Voyagers - datavoyagers.net