Skip to main content

Water Cooler

This space is for everyone to ask questions related to the Community Platform. It's a space for us to get to know each other and have some fun! Come in and gather around the Water Cooler!

cancel
Showing results for 
Search instead for 
Did you mean: 
aleix_rodriguez
Contributor
Contributor

How to calculate the amount sold in the last invoice

Hello,

I've got a detailed list of invoices (see attached Excel) and I want to plot (in a simple table) the amount sold in the last invoice.

I've been working with it but I've only been able to show the date oh the last invoice delivered but I didn't succeed with the amount.

In the attached Qlikview file you'll find the following columns:

Dimensions:

- Location: is the warehouse where the invoice was delivered

- Article

Expressions:

- Month_9 and Month_10: Is the amount sold during these months

- Last Date: Is the date of the last invoice

- Last Invoice: It should calculate the amount of the last invoice

I hope somebody can help me.

Thanks in advance.

Regards,

Aleix.

3 Replies
Gysbert_Wassenaar

Try FirstSortedValue(Amount,-Date). And remove the duplicate records from your data or you'll get no result for two articles.


talk is cheap, supply exceeds demand
aleix_rodriguez
Contributor
Contributor
Author

Thank you very much, it did work.

But, in case there are two or more sales at the same last date then the result is null.

Is it possible to use an expression like : sum(if(Date=max(date), Amount)) ?

Thank you in advance for your help.

Regards,

Gysbert_Wassenaar

Maybe, but far easier and better performing will be adding a flag field in the script. See attached example.


talk is cheap, supply exceeds demand