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: 
beck_bakytbek
Master
Master

FirstSortedValue in Script

Hi Folks, 

i got a Situation , my table does look like:

Project, ProjectName, DateFrom,         DateTo

A,                   A1,                1950-01-01,         2099-12-31

A,                   A2,                1997-01-01,         2099-12-31

A,                 A11,               1997-01-01,         2099-12-31

A,                 A22,               1950-01-01,         2099-12-31

 

from this table I need only:

Project, ProjectName, DateFrom,         DateTo

A,                   A1,                1950-01-01,         2099-12-31

A,                 A22,               1950-01-01,         2099-12-31

 

i tried to resolve this issue with the help of function: FirstSortedValue () based on the field: DateFrom, but it didnt work.

 

Does anybody have any idea, how to resolve this issue?

Thanks a lot in Advance for your help and time.

 

Beck

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar

@beck_bakytbek you can try this

Table:
LOAD * INLINE [
    Project, ProjectName, DateFrom, DateTo
    A, A1, 1950-01-01, 2099-12-31
    A, A2, 1997-01-01, 2099-12-31
    A, A11, 1997-01-01, 2099-12-31
    A, A22, 1950-01-01, 2099-12-31
];

Right Join (Table)
LOAD Project,
	 Min(DateFrom) as DateFrom
Resident Table
Group By Project;

View solution in original post

7 Replies
sunny_talwar

@beck_bakytbek you can try this

Table:
LOAD * INLINE [
    Project, ProjectName, DateFrom, DateTo
    A, A1, 1950-01-01, 2099-12-31
    A, A2, 1997-01-01, 2099-12-31
    A, A11, 1997-01-01, 2099-12-31
    A, A22, 1950-01-01, 2099-12-31
];

Right Join (Table)
LOAD Project,
	 Min(DateFrom) as DateFrom
Resident Table
Group By Project;
Taoufiq_Zarra

@beck_bakytbek  can you elaborate the logic ? how you get the output from your sample ?

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
beck_bakytbek
Master
Master
Author

Sunny thanks a lot for your help and time,

is that possible to resolve this issue with the help of function: FirstSortedValue ()?

beck_bakytbek
Master
Master
Author

Hi Taoufiq_Zarra, thanks a lot your Reply, my logic is: i want to select the value on the base of field: DateFrom = DateFrom (1950-01-01 = the first value).

sunny_talwar

@beck_bakytbek I don't think so because you have two ProjectNames on 1950-01-01... FirstSortedValue will give only one. Why do you want to do this using FirstSortedValue?

beck_bakytbek
Master
Master
Author

Hi Sunny, thanks a lot for your fast Reply, i thought, by using this function (FirstSortedValue) i can sort my values starting from 1950-01-01. So i can Show only the first value or am i missing something? 

beck_bakytbek
Master
Master
Author

Sunny you are absolutely Right, i missunderstand the use of function: FirstSortedValue (). Thanks a lot for your time and help.