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: 
venkatg6759
Creator III
Creator III

Exclude after sorting

Hello All,

I have some tickers which have ratings and rating dates . Ex:

Ticker               Rating         Author                       Rating Date

APPLE              B              Stefan                           01/01/2010 00:00:00

APPLE               Buy          Richard                         01/01/2010 00:00:00

APPLE               NA           Eugene                           05/02/2012 00:00:00

I am getting the max of rating date from this .If max Rating Date matches with Rating NA for each Ticker .It should be excluded.

It should not go back and pick previous rating which is Buy .

Thanks,

Venkata

4 Replies
sudeepkm
Specialist III
Specialist III

Please find the example attached.

Not applicable

Like attached. Please check the back-end and see if data is excluded per your logic.

Hope it helps

Thanks

AJ

maxgro
MVP
MVP

source:

load *, rowno() as id;

load * inline [

Ticker        ,       Rating   ,      Author           ,            Rating Date

APPLE         ,     B     ,         Stefan   ,                        01/01/2010 00:00:00

APPLE         ,      Buy  ,        Richard   ,                      01/01/2010 00:00:00

APPLE         ,      NA   ,        Eugene    ,                       05/02/2012 00:00:00

PA         ,     B     ,         Stefan   ,                        01/01/2010 00:00:00

PA         ,      Buy  ,        Richard   ,                      01/01/2010 00:00:00

PA         ,      Buy   ,        Eugene    ,                       05/02/2012 00:00:00

PB         ,     B     ,         Stefan   ,                        01/01/2010 00:00:00

PB         ,      NA  ,        Richard   ,                      01/01/2010 00:00:00

PB         ,      NA   ,        Eugene    ,                       05/02/2012 00:00:00

PC         ,     B     ,         Stefan   ,                        01/01/2010 00:00:00

PC         ,      Buy  ,        Richard   ,                      01/01/2010 00:00:00

PC         ,      NA   ,        Eugene    ,                       05/02/2012 00:00:00

PC         ,      NA   ,        Eugene    ,                       05/02/2012 00:00:00

];

NoConcatenate

load *

Resident source

where Rating <> 'NA'

and Peek(Ticker)<>Ticker

order by Ticker, [Rating Date] desc, id desc;

;

DROP Table source;

venkatg6759
Creator III
Creator III
Author

Hi Sudeep ,

thanks for your reply. I have one more question .

when the user selects some date range the rating should appear. How can i achieve it.

If suppose user selects dates from 2010 - 2012

Ticker               Rating         Author                       Rating Date

APPLE              B              Stefan                           01/01/2010 00:00:00

APPLE              N              Stefan                           05/01/2012 00:00:00

APPLE              NA             Richard                          05/01/2014 00:00:00


Here the date range is 2010 - 2012 So, the Ticker should appear since it has rating N which is not happening in the above attached qvw .

Any solution or ideas