Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
modara
Creator
Creator

Simple calculation

Dear Concern,

 

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.

Regards

2 Solutions

Accepted Solutions
Vegar
MVP
MVP

What does your data model look like? Is all the three fields in the same transaction  table?

Example

Product, SalesQty, ReturnQty,Price

Books, 100,0, 10

Books, 200, 100, 10

Pencils, 1000, 10, 1

Pencils, 1000, 0, 1

 

I'm this scenario the sum of Price will become 20 for Books an 2 for Pencils.

Try this expression instead. Then you will calculate the right price per row.

Sum(SalesQty*Retail_Price) - Sum(ReturnQty*Retail_Price)

 

View solution in original post

modara
Creator
Creator
Author

Sum(SalesQty*Retail_Price) - Sum(ReturnQty*Retail_Price)

 

is working. at last. thanks both of you guys

View solution in original post

8 Replies
modara
Creator
Creator
Author

there is no way to calculate this in Qlik sense? I seen 48 people viewed but no one has the answer

saniyask
Creator
Creator

Hi,

Please try the below.

(Sum(SalesQty) - Sum(ReturnQty)) * Sum(Retail_Price)

modara
Creator
Creator
Author

(Sum(SalesQty) - Sum(ReturnQty)) * Sum(Retail_Price)

i also though this was the solution

tried this but not giving correct result. 

modara
Creator
Creator
Author

(Sum(SalesQty) - Sum(ReturnQty)) * Sum(Retail_Price)

i also though this was the solution

tried this but not giving correct result. 

MayilVahanan

Hi Modara,

Please send the sample file & expected output. 

Meanwhile, If all fields are in sample table, try like below

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

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Vegar
MVP
MVP

What does your data model look like? Is all the three fields in the same transaction  table?

Example

Product, SalesQty, ReturnQty,Price

Books, 100,0, 10

Books, 200, 100, 10

Pencils, 1000, 10, 1

Pencils, 1000, 0, 1

 

I'm this scenario the sum of Price will become 20 for Books an 2 for Pencils.

Try this expression instead. Then you will calculate the right price per row.

Sum(SalesQty*Retail_Price) - Sum(ReturnQty*Retail_Price)

 

modara
Creator
Creator
Author

all field are in same field and i tried your solution already but no luck. result gave a huge number which is totally incorrect

when i do sale quantity - return quantity this matches with power bi mean data model is ok but when i do (sale quantity - return quantity) * retail price then its not giving me correct

 

same data

(sale quantity - return quantity) * retail price

(2-0) * 234= so result should be 468and power bi shows me 468

 

doing this 

Sum(SalesQty*Retail_Price) - Sum(ReturnQty*Retail_Price)

in Qlick sense it showing me 504 

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

in Qlick sense it showing me 504 same 

 

*** I also tried 

(SalesQty-ReturnQty)*Retail_Price---- and it give me 252 which is half of 504. so where is the issue? anyone has any idea?

 

modara
Creator
Creator
Author

Sum(SalesQty*Retail_Price) - Sum(ReturnQty*Retail_Price)

 

is working. at last. thanks both of you guys