Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Make your voice heard! Participate in the 2020 Wisdom of Crowds® Survey. BEGIN SURVEY
Highlighted
jaymeknapp
New Contributor

Sum by Order Number with multiple dates

I have a data table that we reload every day, using the Load Date to separate on which date we grabbed the data.

Here is an example of what the data table looks like:Capture.PNG 

 

 

 

 

 

 

I'm trying to come up with a SUM(Amount) and SUM(Quantity), by distinct Transaction Number.  The challenge I'm having is that an Item can appear many times in a Transaction Number.  For example Item Label 101 in that first transaction is actually 2 line items for a Quantity of 1 each.  

Jayme

 

Labels (2)
5 Replies
Highlighted
Partner
Partner

Re: Sum by Order Number with multiple dates

what does your expected result is?
Highlighted
jaymeknapp
New Contributor

Re: Sum by Order Number with multiple dates

Expected result would be as follows:

Item                Amount      Quantity

Label 101     $283              2

Label 333     $158             1

Label 458     $395             3

 

We could even include MAX(Load Date) in the set analysis if need be... just not sure how to do that. 

Highlighted
Partner
Partner

Re: Sum by Order Number with multiple dates

you could try using the below expression for amount expression:
=sum( aggr( FirstSortedValue( amount, -[Load Date] ), [Transaction Number] ) )
i hope it helps.
Highlighted
jaymeknapp
New Contributor

Re: Sum by Order Number with multiple dates

this expression is giving me $0

=sum( aggr( FirstSortedValue( amount, -[Load Date] ), [Transaction Number] ) )

Highlighted
Partner
Partner

Re: Sum by Order Number with multiple dates

maybe this:
=sum( aggr( FirstSortedValue( Amount, -[Load Date] ), [Transaction Number] ) )