Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
stasvdbraber
Contributor
Contributor

Multiplying in specific order

Hello Qlik Users,

I have an 'Order Details' table presented below. I would like to calculate the gross sales, which is the [UnitPrice]*[Quantity]. However, one 'OrderID' consists of multiple order lines called 'LineNo'. What expression can I use to make sure that it multiplies in a specific order?

For example: 

For OrderID (10248) 

Gross Sales =   (14,04*10) + (12,71*5) + (28,62*12) = 547.39 

OrderDetails Table.JPG

 The expression 'Sum(total Quantity)*Sum(total UnitPrice)' does not work as it first sums up the Quantity and UnitPrice and afterwards it multiplies. I need an expression that multiplies first and adds up next. 

Thanks in advance!

1 Reply
Gysbert_Wassenaar

Sum(Quantity*UnitPrice)

talk is cheap, supply exceeds demand