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: 
Anonymous
Not applicable

Problem with Max Function

Hello Community. I have a problem with the max function that I hope you can help me with:

I have the following data:

 

SellerIDSellerContractIDDepartmentYear
John11A2010
Tom22B2011
Joe33C2012
Sam44D2013
John15E2014

What I want to do, is only show the most recent data for each Seller, this means that the Seller John shuld only appear once with the data from the most recent year (2014). So the data should look like this:

 

SellerIDSellerContractIDDepartmentYear
Tom22B2011
Joe33C2012
Sam44D2013
John15E2014

Hope you can help me

4 Replies
Clever_Anjos
Employee
Employee

Use

FirstSortedValue(Department,-Year)

FirstSortedValue(ContractID,-Year)

maximiliano_vel
Partner - Creator III
Partner - Creator III

LOAD

     Seller,

     IDSeller,

     FirstSortedValue(ContractID, -Year) as ContractID,

     FirstSortedValue(Department, -Year) as Department,

     FirstSortedValue(Year, -Year) as Year

FROM [Contracts.xlsx]

(ooxml, embedded labels, table is Sheet1)

GROUP BY Seller, IDSeller;

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

Data:

LOAD

*

FROM DataSource;

LEFT JOIN(Data)

LOAD

IDSeller,

Max(ContractID) AS ContractID,

1 AS LatestFlag

RESIDENT Data;


Now in chart try like this

Chart : Straight Table

Dimension:Seller,IDSeller,ContractID,Department

Expression: Only({<LatestFlag={1}>} Year)

Hope this helps you.

Regards,

jagan.


sasiparupudi1
Master III
Master III

Hi

Please check the attached file. hope this helps

Sasi