Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Vassilis
Contributor
Contributor

last row of continues data

Hi!

I'm working in data with the below fields:

year  |  quarter  |  itemid  |  item description  |  quantity  |  ect.

In order to take the last value of every  item (eg. the quantity of the last quarter and last year), I created a rank field as an index of every item. I have achieved to catch the last row of every item with the below expressions:

 

expression 1:    aggr(max(Rank),[Κωδ. Είδους S ])     

for your information:
 (Κωδ. Είδους =item id)

expression 2:  sum({<Rank={"$(= aggr(max(Rank),[Κωδ. Είδους SAP]))"}>} qty)

The problem:

When I have only one item in the filter is ok, but if I clear the filter and the chart table is for all items is returned only null values

Sorry for the draw in print screens!

2 Replies
stevejoyce
Specialist II
Specialist II

expression 2 wont work, it's not going to limit by Rank + Item.  If you want to go down this route you'd need a composite key, let's say it's item + rank.

data:

load *

,autonumber(item&rank) as item_rank_id

;

load

year  |  quarter  |  itemid  |  item description  |  quantity  | etc.

from wherever.

 

then your expression could be 
sum({<item_rank_id={"=rank = aggr(nodistinct max(Rank),[Κωδ. Είδους SAP]))"}>} qty)

Vassilis
Contributor
Contributor
Author

Thank you for your reply,

I tried your approach but it didn't play.
I received a new field with a unique number for each row (1 - number of total rows).
As a result I took a sum of quantity.

Generally, I want to take back the last row of each item.

For example:

1)2008 Q1 item1

2)2008 Q2 item1

3)2008 Q3 item1

4)2008 Q4 item1

5)2009 Q1 item1

6)2009 Q2 item1

7)2009 Q4 item1

 

8)2008 Q1 item2

9)2008 Q2 item2

10)2008 Q3 item2

11)2008 Q4 item2

12)2009 Q1 item2

13)2009 Q2 item2

14)2009 Q3 item2

15)2009 Q4 item2


.

.

.

.

 

That I want is only the rows 7 and 15 and ...