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

Get sum of quantity by each row and not by total

Hi all,

I want to divide the value by sum of  quantity.  I want the sum of quantity for a particular ID. But when dividing the quantity, it is divided by total quantity.

 

E.g In the attached screenshot.. The Qty is divided by 7. But i want to divide by sum of qty of each row.

 

6 Replies
Taoufiq_Zarra

may be

=sum(Total <dimension> quantity)
Regards,
Taoufiq ZARRA

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

(you can mark up to 3 "solutions") 😉
iswarya
Partner - Creator
Partner - Creator
Author

But I don't want to get the total. In the attachment, I want to divide the value by 3 or 1 and not by the total

Taoufiq_Zarra

if i understood correctly

sum(Total quantity)/sum(Total <dimension> quantity)

if not can you share a sample data and the expected output

Regards,
Taoufiq ZARRA

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

(you can mark up to 3 "solutions") 😉
iswarya
Partner - Creator
Partner - Creator
Author

I want data only from ID=10, but for sum(qty) I get the total of qty(ID value not equal to 10 also included).

I have written set as: Sum(Qty) with date=max(date) & Id=10

Taoufiq_Zarra

i think you need just

dimension : Item,date,value and qty

expression :

=Sum({<ID={'10'},date={"$(=Date(Max(date)))"}>} value/qty)

Capture.PNG

Regards,
Taoufiq ZARRA

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

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

as your ID column is not exactly "10", you need to use wildcard in set analysis. Also make sure that Date format in set analysis match with actual date field format

=Sum({<ID={'*10-*'},date={"$(=Date(Max(date),'MM/DD/YYYY'))"}>} value/qty)