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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

ApplyMap with Max

Hi Guys,

I have table with 3 fields:

ID_number (Klucz_Mandant_Nr_osobowy) Company (JG_skrót) and Date_of_Fire (Data_zwolnienia).

For each Id_number can be a few companies and for each companies can be few Dates.

Example:

600-000002,  Company 1, Date - 2017-09-25

600-000002,  Company 2, Date - 2015-01-02

And now i want to have the result in apply map as :

600-000002, Company 1

Company 1 has date greater then Company2 so the applymap should take the first one (max date)

How can i do this ?

Please help,

Jacek Antek

11 Replies
Anonymous
Not applicable
Author

I have checked this and my row source table looks like:

qlik2.png

I have to take only last row from this table with max date.

We should not have more than 1 company for each date in my model.

It seems that FirstSortedValue should work here.

Best Wishes,

Jacek

daveamz
Partner - Creator III
Partner - Creator III

Hi Jacek,

If there are no nulls in Data_zwolnienia you can use:

_temp:

LOAD Klucz_Mandant_Nr_osobowy,

          AutoNumber(RowNo(), Klucz_Mandant_Nr_osobowy) AS Sort_ID,

     JG_skrót,

          Data_zwolnienia

RESIDENT Facts

ORDER BY Klucz_Mandant_Nr_osobowy, Data_zwolnienia DESC;



MapID2Company:

MAPPING

LOAD Klucz_Mandant_Nr_osobowy AS IndexValue,

     JG_skrót                 AS TranslationValue

RESIDENT _temp

WHERE Sort_ID = 1;


DROP TABLE _temp;


Regards,

David