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

Total Basket Sales


Hi,

I am trying to create a chart that shows total basket size in dollars for any item. We want to answer questions like how much money does a cusrtomer spend when they buy bananas ... or laundry detergent.

I am able to identify the transactions containing the item using the following:

     Concat ({1<Transaction = p(Transaction)>} Transaction, ', ')


Creating a chart with the item dimension and this formula returns the following ... which is correct:

ItemHH countTX countconcat TX
Bananas221, 2
Bread111
Chicken111
Crackers121, 3
Milk121, 3
Pasta221, 2
Pasta Sauce221, 2
Soup121, 3


I then want to find the total sales of the transactions that had those items. I do this using the following:

     Sum (TOTAL{1<Transaction={$(=Concat({1<Transaction = p(Transaction), Customer=p(Customer)>} Transaction, ','))}>} [Sales Dollars])

However, this formula brings back the total sales of all transactions ... not just the sales for the transactions the item participated in.


Is there something wrong with the syntax of the concat clause?

Sample information:

LOAD * INLINE [

Transaction, Customer, Dept, Item, Sales Dollars

1, 1, Grocery, Soup, 1

1, 1, Grocery, Crackers, 3

1, 1, Dairy, Milk, 4.5

1, 1, Grocery, Bread, 2

1, 1, Produce, Bananas, 1.5

1, 1, Meats, Chicken, 5

1, 1, Grocery, Pasta, 3

1, 1, Grocery, Pasta Sauce, 2

2, 2, Produce, Bananas, 2

2, 2, Grocery, Pasta, 3

2, 2, Grocery, Pasta Sauce, 4

3, 1, Grocery, Soup, 1

3, 1, Grocery, Crackers, 3

3, 1, Dairy, Milk, 4.5

]

2 Replies
israrkhan
Specialist II
Specialist II

Hi Try Below:

Sum (TOTAL{1<Transaction={$(=Concat({<Transaction = p(Transaction), Customer=p(Customer)>} Transaction, ','))}>} [Sales Dollars])



MK_QSL
MVP
MVP

Try This....

SUM({<Transaction={$(=Concat({<Transaction = p(Transaction), Customer=p(Customer)>} Transaction, ','))}>} [Sales Dollars])