Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

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

Re: MAX (Total) not working

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

You may need to use Aggr function.

vishalwaghole
Valued Contributor II

Re: MAX (Total) not working

Hi,

Please try this one.

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

Regards,

VIshal

narender123
Valued Contributor

Re: MAX (Total) not working

You can also try this one as:

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

Regards:

Narender

Not applicable

Re: MAX (Total) not working

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

anantmaxx
Contributor III

Re: MAX (Total) not working

use this

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

Best Regards,

Anant

MVP
MVP

Re: MAX (Total) not working

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

Re: MAX (Total) not working

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

Re: MAX (Total) not working

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

Re: MAX (Total) not working

Can you upload your Sample Application

Community Browser