Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

data manipulation - last child

hi ,

lets sat we have this data fields,

mon, year, age

i wont to get the last age for each year.

if i looked on it in a pivot table by months i can see the total ages for each mon by

addig the expression sum(age) ,

but if i want to see it by years i want to get the age of the last month for each year,

i dont want to sum all ages for each year just the last one!!

any suggestion will be great.

And anther small question is , in a chart expretion how do i find to which dimension i worked

with mon or year ?(to set the right expression for each dim.)

thnx,

yuyu

1 Reply
Not applicable
Author

hi,

To answer your last question, in chart expression, you can know which dimension you are working on by using Dimensionality(). The leftmost dimension is 1, the one after that is 2 etc.

Based on this, you can create a if condition to get what you want. In your case, for months you want the sum of ages but for year you want the age of the last month of the year. Your expression will be

=if(Dimensionality()=1,Sum({<mon={"$(=max(mon))"}>}age),sum(age))

I have attached an example. Let me know if this is what you were looking for.

Nimish