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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
drohm002
Creator II
Creator II

create variable or expression

Hi, please see table below.  How can I create a variable or an expression that returns only one score per company, based on the earliest date?

Thank you.

   

IDScoreDateCompany
bill41/1/2016Blue
bill76/1/2016Blue
sam82/1/2016Blue
sam27/1/2016Blue
jon93/1/2016red
jon38/1/2016red
adam115/1/2016red
adam67/1/2016red
6 Replies
martinpohl
Partner - Master
Partner - Master

Do it in the script:

load YourData;

FirstScore:

load distinct Company

resident YourData;

left join load

Company,

min(Date) as FirstDate

resident YourData

Group by Company;

left join load

Company,

Date as FirstDate,

Score as FirstScore

resident YourData;

drop field FirstDate;

Regards

drohm002
Creator II
Creator II
Author

is it possible to not do it in the script?  the company field is from a different table than all the other fields so I'm having trouble using Company in the script...

drohm002
Creator II
Creator II
Author

I have a flag set up to find the min date.  can we use that in a variable or expression to help us?

andrey_krylov
Specialist
Specialist

Hi Daniel. Maybe FirstSortedValue(TOTAL <Company> Score, Date)

drohm002
Creator II
Creator II
Author

is TOTAL a function?

sergio0592
Specialist III
Specialist III

TOTAL is not a function. It's a key word which can be explained with :

The TOTAL qualifier is added to aggregation functions to disregard chart

dimensions and make the calculation over the entire record set as defined

by the current selection state.