Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

MAX (Total) not working

Hi,

I have a table of inventory items transactions, I'm trying to have a pivot table per item and other dimensions to get the unit cost per item for the last transaction done per date, but its working only for one item selected, but for all items it result with zero, following expression had been used

sum(if(trasaction_date=MAX(TOTAL transaction_date),trasaction_cost,0))

if someone can help on this issue, thank you

Firas Ahmed

14 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

Can you upload sample file? It helps to understand your problem easier.

You may need to use Aggr function.

VishalWaghole
Specialist II
Specialist II

Hi,

Please try this one.

sum(if(trasaction_date=aggr(MAX(TOTAL transaction_date),item)trasaction_cost,0))

Regards,

VIshal

narender123
Specialist
Specialist

You can also try this one as:

if(trasaction_date=MAX(TOTAL transaction_date),sum(trasaction_cost),0)

Regards:

Narender

Not applicable
Author

HI Ahmed,

First you store the MAX transaction_date in to a variable.

You can use this variable in the expression, it will be eaiser way.

Regards,

Yaseen

Anonymous
Not applicable
Author

use this

=sum(aggr(max(date),Transation_id)transaction_cost)

Best Regards,

Anant

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Something like this:

Sum({<trasaction_date = {"$(=Date(Max(transaction_date)))"} trasaction_cost)

Hope that helps

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

thank you Vishal, statement did not solve the issue, it returns zero always (one or all items), it may missing one more parameter

Not applicable
Author

thank you all for reply, but actually it did not work, all of them still return zero, I would appreciate your help I will brief issue again just in case:

table structure (item, quantity, cost, transaction date)

dashboard target : inventory aging

current issue: to get the cost of the last transaction per item as per date dimension selected

regards

Firas

Not applicable
Author

Can you upload your Sample Application