Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikwiz123
Creator III
Creator III

Aggregate Results

I have a Straight Table with the following Data

ItemSizeUnitStockUnit Stock
    247,204
ShirtShirt8814,100112,800
ShirtShirt4433,601134,404

 

Unit Stock field is calculated by Unit*Stock

Expression for 'Unit' is 

Sum(Aggr( [Unit],[Size]))

Expression for 'Stock' is 

Aggr(Sum(Stock), Size)

But when I remove 'Size' from the table, the table is shown as 

ItemSizeUnitStock
   0
Shirt12--

 

How do I achieve the first table without showing 'Size' column?

If I remove aggr in 'Stock',  and use (Sum( Stock ), it is doing 12 (8+4) * 47701 (14100+33601) instead of  (8*14100) + (4*33601).

 

My end table should look like this :

 

ItemStock
 247204
Shirt247204

 

where Stock is calculated as (8*14100) + (4*33601).

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar

Try this

Sum(Unit * Stock)

or this

Sum(Aggr(Sum(Unit * Stock), Item, Size, Unit))

View solution in original post

6 Replies
sunny_talwar

Try this

Sum(Unit * Stock)

or this

Sum(Aggr(Sum(Unit * Stock), Item, Size, Unit))
qlikwiz123
Creator III
Creator III
Author

Hi @sunny_talwar 

 

I am using expression

Sum({$<Date = {"$(=Date(vMaxDate, 'MM/DD/YYYY'))"}>} [Stock]) for calculating my Stock as I need to see only at Stocks for recent date. I am not sure if this is causing an issue but when I remove Size, Unit, the Stock column shows '-' 

sunny_talwar

Not sure why that would happen... the expression you shared is the only thing you are using, right? no aggr() or if statements or anything else?

qlikwiz123
Creator III
Creator III
Author

To calculate the stock, yes. Sum({$<Date = {"$(=Date(vMaxDate, 'MM/DD/YYYY'))"}>} [Stock]) is how I find the Stock for the latest date and doing a Sum on it. Nothing else.

sunny_talwar

Would you be able to share a sample where we can see the issue?

qlikwiz123
Creator III
Creator III
Author

I think I got what the issue is. I had to implement the logic I was using in the script instead of the chart and that fixed it. Weird but true.

 

Thank you so much @sunny_talwar  🙂