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

Basic multiplication, subtraction and division

Can someone tell me what I am doing wrong here? I simply want to subtract two figures and then divide them to find our profit per job.

 

I have our overall profit by using the expression:

Sum([Earnings])-Sum([Expenses])

 

I have the total number of jobs by using the expression:

Count([JobNumber])

 

I would have thought then to find the profit per job the expression would be: 

Sum([Earnings])-Sum([Expenses])/Count([JobNumber])

 

As an example: our Expenses are $1,000. Our Earnings are $3,000. Profit is $2,000. We completed 100 Jobs. Therefore profit per job should be $20. Using the above formula I get an amount 10 times this.

Math was never my strength.... what am I doing wrong here?

1 Solution

Accepted Solutions
Taoufiq_Zarra

Maye be jus add ()

(Sum([Earnings])-Sum([Expenses]))/Count([JobNumber])

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

4 Replies
Taoufiq_Zarra

Maye be jus add ()

(Sum([Earnings])-Sum([Expenses]))/Count([JobNumber])

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
HITECHFS
Contributor II
Contributor II
Author

@Taoufiq_Zarra  Thankyou! BODMAS, of course. I suspected this, but I couldn't figure out where to put the brackets. Really appreciate your help.

modara
Creator
Creator

I want to do very simple calculation as measure  or expression in qlik sense

 

I want to do following

(Column A - Column B)* Column C

(Sale Quantity - Return Quantity) * Retail Price

I want it as function or expression or in measure. I don't want to do in Load.

I follow your instruction and can able to do

                            sum(Sale Quantity)-Sum(Return Quantity)

but when I

                              (sum(Sale Quantity)-Sum(Return Quantity)) * sum( Retail Price)

it gives me wrong result

please help

HITECHFS
Contributor II
Contributor II
Author

Hi Modara,

Maths was never my strong suit so I am really not sure, but given you are multiplying rather than dividing you may need to put the brackets around the 2nd part of the equation.

Try posting a question separately and someone smarter than me will be able to offer advice I am sure.