Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
EHrsa
Partner - Contributor
Partner - Contributor

Display last transactions with multiple rows

How to display the last transaction that has multiple rows.  Example here is my data

transaction_id transaction_date account_name items amount
9850840 5/10/2004 Mikey A 10
9850840 5/10/2004 Mikey B 15
9850840 5/10/2004 Mikey C 20
4536281 5/11/2004 Mikey D 10
4536281 5/11/2004 Mikey E 15
4536281 5/11/2004 Mikey F 20
7653428 5/12/2004

Mikey

G 10
7653428 5/12/2004 Mikey H 15
7653428 5/12/2004 Mikey I 20
         
7894566 5/11/2004 James A 15
7894566 5/11/2004 James C 20
7894566 5/12/2004 James D 10
8664523 5/12/2004 James E 20
8664523 5/12/2004 James E 20
8664523 5/12/2004 James K 30

 

I want to display in a chart table

account_name items amount
Mikey G 10
Mikey H 15
Mikey I 20
James E 20
James E 20
James K

30


The Example I saw mostly sum up the amount, so it will only have 1 rec per account name, but i want to display the details.
master item last_transaction_id = FirstSortedValue(transaction_id,-transaction_date,account_name) will give me the last transaction_id per account name.  How do I display all records associated with this transaction_id if I dont want to display the transaction_id.  I can't get the set analysis syntax correctly, something like  {<transaction_id = last_transaction_id>} account_name,  {<transaction_id = last_transaction_id>} item, {<transaction_id = last_transaction_id>} Amount.  i appreciate any help on this.  Thanks.

Labels (3)
2 Replies
HirisH_V7
Master
Master

First convert your transaction date from text to date/num format.

Date#(transaction_date,'MM/DD/YYYY') as transaction_date_Converted

Then Use this below expression with your dimension in table,

Sum({<transaction_date_Converted={"$(=Date(Max(transaction_date_Converted),'M/DD/YYYY'))"}>}amount)

 

HirisH
“Aspire to Inspire before we Expire!”
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

It is not set analysis thing - it is the way Qlik objects are designed to work to always show you unique combinations of records + possibly aggregation.

The tricky bit indeed will be to have individual records as by default they will be grouped to dimensions used in the table object. 

You say you dont want to use transaction_id in your table, but in reality you will have to retain granularity required to show all separate records.

Even on your example you dont have required granularity because your table 

8664523 5/12/2004 James E 20
8664523 5/12/2004 James E 20
8664523 5/12/2004 James K 30

in qlik UI object would be converted to this:

8664523 5/12/2004 James E 40
8664523 5/12/2004 James K 30

 

In order for you to retain granularity you would have to have unique identifier per each row you are wanting to display. Only then you could play around and possibly use calculated dimention with things like Dual() to show for example name but hold value of that unique identifier.

cheers

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.