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

PIVOT TABLE

Hello Everyone,

I have a problem using a pivot table.

I have these columns:

  • WEEK
  • CITY
  • COUNTRY
  • SALES

Well, what I'd like to do is to calculate the percentage of the sales in every city, per week.

I need to find a way to calculate the ratio between SUM(SALES) and the subtotal (per week and city).

Could you please help me?

Many thanks in advance

1 Solution

Accepted Solutions
sunny_talwar

I would rather use TOTAL without Aggr() here

Sum(Sales)/Sum(TOTAL <Country, City, Week> Sales)

View solution in original post

4 Replies
sunny_talwar

Would you be able to provide a sample where we can help you? It would be also be helpful to know the expected output based on your provided sample

Anonymous
Not applicable

If you have all of the above columns in your pivot and your sales exp is like sum(Sales)

try something like this for the ratio:

sum(Sales) / aggr(sum(total Sales),Country,City,Week)

OR

sum(Sales) / sum(aggr(sum(total Sales),Country,City,Week))

sunny_talwar

I would rather use TOTAL without Aggr() here

Sum(Sales)/Sum(TOTAL <Country, City, Week> Sales)

marikabi
Creator
Creator
Author

Thank you Sunny and Qlikdeez for your quick answers

Indeed, Sunny, you have solved my problem (just one thing, after TOTAL I put only WEEK)... maybe I wrote the message in an unclear way..but you are both really really kind, and you helped me a lot!

Thank you