Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Peony
Creator III
Creator III

How to calculate Total upc sales within categoty

Hi all
I need to create a pivot table with a calculation where Sum(Sales) for UPC is divided by Sum(Sales) for particular category, this UPC is related

Test_Table:
LOAD * INLINE [
Category, UPC, Sales
Beverages, 123, 1500
Dairy, 987, 2300
Dairy, 456, 1200 ]; 

So 
For UPC 123 = 1500/1500
For UPC 987 = 2300/(2300+1200)
For UPC 456= 1200/(2300+1200)

This should be something like Sum(Sales)/Sum(Total Sales). But how to add an analysis part so that the category is also included?

Labels (1)
1 Solution

Accepted Solutions
robert_mika
Master III
Master III

Try:


Sum(Sales) / Sum({<UPC=, Category=P(Category)>} Sales)

View solution in original post

2 Replies
robert_mika
Master III
Master III

Try:


Sum(Sales) / Sum({<UPC=, Category=P(Category)>} Sales)

Peony
Creator III
Creator III
Author

Hi @robert_mika  This is it! Thank you!