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

Trying to get TOTAL SALES...

Hi, i have a Stock Movement app which i am having trouble displaying TOTAL SALES on.

In the app the user selects the 'Stock Movement' that they wish to view..

i.e.

Wastage

Reductions

Goods Received

etc

I am loading in a product sales table and movement table.

After the user selects a Movement Reason (lets say Wastage for this example), only the sales for the day of the wastage is displayed.

I want the app to display the TOTAL SALES for the product regardless of any other movement or not.

See example below of the WRONG result..

waste.JPG

And the result i want to see is 1 line (as its only the top line that has waste against it) but with the total sales of 44, not 7.

Does anyone know how i can achieve this?

1 Solution

Accepted Solutions
Not applicable

If i have got what you are after

sum(TOTAL {$<[Stock Reason] = >} SalesQuantity)

should work.

This will preserve all of your other selections, Dept etc but will ignore any selections made in the Stock Reason Field.

View solution in original post

10 Replies
Not applicable

Hi

You should be able to get this with teh aggr function

Try

aggr(NODISTINCT Sum(Total Sales Qty), Product Code)

Mo

hopkinsc
Partner - Specialist III
Partner - Specialist III
Author

Hi, thanks for your reply.

That expression only gave me the total sales if NO movement reason is selected. If i select Wastage, then it displays total sales of 7 which is the sales of the day the wastage was performed.

see below

         

     This is when i select a movement reason (Wastage)

waste1.JPG

This is where no movement selections have been made..

waste2.JPG

So the result i want is the 2nd pic but when i reason is selected.

Not applicable

try changing the sum( to sum(TOTAL ...

If that does not work can you post me some sample data and i will work at it here?

hopkinsc
Partner - Specialist III
Partner - Specialist III
Author

Hi mark, that didn't work either...

attached is a sample.

If you look at it as it is, the sales values are correct.

but if you select GFSU from the bottom left, the sales value changes to the sales where GFSU took place. I want the sales values to always display the sales correctly for the dates selected...

Thanks for looking..

Not applicable

Hi, I am new to Qlikview myself but I know you can do this, I think it is via Set Analysis where you can set a value based on selections but ignoring the selections in a specific field.

I will work that through on your file and advise, sorry for delay !!

hopkinsc
Partner - Specialist III
Partner - Specialist III
Author

Thats great, thanks mark. No rush, i am going home now, back in on Monday

Thanks again.

Not applicable

If i have got what you are after

sum(TOTAL {$<[Stock Reason] = >} SalesQuantity)

should work.

This will preserve all of your other selections, Dept etc but will ignore any selections made in the Stock Reason Field.

hopkinsc
Partner - Specialist III
Partner - Specialist III
Author

Morning Mark, thanks for this expression.

It works as expected if i am only viewing 1 product. But if i am viewing multiple products then it sums up the complete sales for all products viewed.

I have attached another sample (as the first sample only had 1 product)

If you look at the chart as it is, you will see that the sales on all prodycts are the same (161)

If you then select the first product (Product code ID8543) the sales drop to 10 (which is correct for this product) from this point on the expression works. But i would need it to work no matter how many products were being displayed.

Can you help with this?

hopkinsc
Partner - Specialist III
Partner - Specialist III
Author

Sorry Mark, ignore my last reply i removed the TOTAL from the expression and it works as expected. Thanks for your help