Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
schmidtj
Creator II
Creator II

Getting value for max date

Hi!

I have a problem aggregating a value from my data.

I have found several forum posts but for some reason they dont seem to work for me.

I guess i do something wrong.

Im breaking my problem down to a simple example.

This is my data:

Columns: ID, TABLENAME, NUMBER_ARTICLES

15, 'Warehouse1', 563

13, 'Warehouse1', 60

11, 'Warehouse2', 1500

10, 'Warehouse2', 12

Per warehouse I would now like to get the number of articles of the row with the highest id.

So basically this:

- 15, 'Warehouse1', 563

- 11, 'Warehouse2', 1500

I tried it with set analysis but i cant get it to work.

This is the formular for the number of articles.

On the other axis i am displaying the warehouse.

max

    {

        $<         

            [ID]={'$(=max( [ID] ))'}

        >

    }

    [NUMBER_ARTICLES]   

)

Can somebody tell me what i am doing wrong?

1 Solution

Accepted Solutions
OmarBenSalem

Try this:

aggr(FirstSortedValue(ID,-NUMBER_ARTICLES),TABLENAME)

result :

Capture.PNG

View solution in original post

3 Replies
lironbaram
Partner - Master III
Partner - Master III

hi

you can't use set analysis in your case

because set analysis isn't calculated on raw basis bot on the whole data set

so max id will only bring back one value in your case 15

you can use this function instead

FirstSortedValue(NUMBER_ARTICLES,-ID)

OmarBenSalem

Try this:

aggr(FirstSortedValue(ID,-NUMBER_ARTICLES),TABLENAME)

result :

Capture.PNG

schmidtj
Creator II
Creator II
Author

The parameters are switched but that's exatcly what i needed

Thanks a lot!