Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Issue with firstsortedvalue

Hi Friends,

I'm struck with some issue related to firstsortedvalue.

I wrote a statement in my script like

firstsortedvalue(ID,-Time) as UserID----- This statement will return the id of the user based on the latest time.

firstsortedvalue(ID,Time) as UserID--- This statement will return the id of the user based on the earliest  time.

But what I want is all the users who has done some particular task based on my where clause.

so I also tried just

ID as UserID--- But it is giving me all the data, wrt other users also.

Can you help me in this.

Thanks,

Sindhu

10 Replies
anbu1984
Honored Contributor III

Re: Issue with firstsortedvalue

What is your where clause?

geminihzh
Valued Contributor

Re: Issue with firstsortedvalue

Can you use the WHERE clause in the  LOAD and SELECT process?

LOAD

...,

ID as UserID;

SQL SELECT

...,

ID

FROM ..

WHERE clause;


If not, then you can try to use if() in the "Enable Conditional" in the Dimension tab to filter the ID you want.

Not applicable

Re: Issue with firstsortedvalue

My where clause is like from_task='Start' to_task='Build'

Not applicable

Re: Issue with firstsortedvalue

Hi Zhihong,

There are 100's of users, i cannot filter based on one user.
I tried in the expression with distinct keyword, but its not working.

anbu1984
Honored Contributor III

Re: Issue with firstsortedvalue

So you want the users who has both from_task='Start' and to_task='Build'?

Can you post your script along with your sample data.

Not applicable

Re: Issue with firstsortedvalue

Hi Anbu,

Left JOin(MasterTable)

Load

     Bundle,

     ID as UserID

From table.qvd

where from_task='Start'

and to_task='Build';

anbu1984
Honored Contributor III

Re: Issue with firstsortedvalue

What is join key to your master table? Above where clause won't affect results of master table since left join is performed

Not applicable

Re: Issue with firstsortedvalue

Bundle is the join key to the master table which is unique.

Yes it will not affect.

sasikanth
Valued Contributor III

Re: Issue with firstsortedvalue

HI

Try the same in Resident load , that may work

Community Browser