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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

new to set anlysis

Hi,

I have a table for programs and statuses

Program     status     StatusNumber   IslastStatus  from_date          stasusname

P1               10               1                    0               01/01/2010          Stat10

P1               20               2                    0               15/03/2012          Stat20

P1               30               3                    1               18/06/2015          Stat30

P2               20               1                    0               20/12/2014          Stat20

P2               50               2                    0               18/04/2015          Stat50

P2               80               3                    1               03/01/2016          Stat80

i want to display in a chart for each prorgam:

Program

last status date

last statusname

status date before the lastone

statusname before the last one

i have problem with the 2 last fields...

i tried using in the expression  set analysis with

= aggr( max(  {$<StatusNumber   ={"=$(StatusNumber -1)"}> }  from_date )  ,Program  )

something is not working...

also what should be the expression for the "statusname before the last one" ?

thank you

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

last status date: max(from_date)

last statusname: firstsortedvalue(stasusname, -from_date)

status date before the lastone: max(from_date,2)

statusname before the last one: firstsortedvalue(stasusname, -from_date, 2)


nb. make sure to use the exact case sensitive field names from your data model.


talk is cheap, supply exceeds demand

View solution in original post

8 Replies
swuehl
MVP
MVP

Try

=Max(from_date, 2)

resp.

=FirstSortedValue( statusname, -from_date,2 )

sunny_talwar

What is the expected output here?

Chanty4u
MVP
MVP

Max(Datefield)--->latest

Max(DateField,2)---->Previous

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

last status date: max(from_date)

last statusname: firstsortedvalue(stasusname, -from_date)

status date before the lastone: max(from_date,2)

statusname before the last one: firstsortedvalue(stasusname, -from_date, 2)


nb. make sure to use the exact case sensitive field names from your data model.


talk is cheap, supply exceeds demand
Not applicable
Author

Thank you. it worked!

agustinbobba
Partner - Creator
Partner - Creator

Hi Odelya!

Please remember mark the answer as correct

Best Regard!

Agustin

Not applicable
Author

Hi,

i don't see where to mark the answer as correct

where can i find it?

sunny_talwar

Look at this document to know how to mark correct and helpful answers -> Qlik Community Tip: Marking Replies as Correct or Helpful