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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

help in list box expression

Hi

i have list box containing Sales_date .It has date from 2011 to 2015.

I need the only years of the sales_date like year(Sales_date).I need only distinct values like 2011,2012,2013,2014,2015.

Thanks

17 Replies
amit_saini
Master III
Master III

RGV,

Hope this will help u. Also if you are having different date format than do changes according .

Thanks,
AS

nagarjuna_kotha
Partner - Specialist II
Partner - Specialist II

Hi,

Try like this,

Year(FieldName) as Year

Example :

Ur fileld name is " Emp_Join_Date "

>>>>>Year( Emp_Join_Date) as Year.


You will get exactly as u want.




Regards,

Nagarjuna

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try like this

Year(YearStart(Sales_date))  -- It will give distinct values.


The best solution is move this Year calculation to script, so that the performance would be better and logic is centralized.


LOAD

*,

Year(Sales_date) AS Year

FROM DataSource;


Hope this helps you.


Regards,

Jagan.

Anonymous
Not applicable
Author

may be your date format is  the issue so try

Year(Date(Reported_Date)) as Year,

also try to convert in num() first then use date function if above is not working.

Thanks

BKC

Anonymous
Not applicable
Author

Hi jagan,

I am still getting duplicate year values in list box

Here is my sample data

LOAD * INLINE [

    Date

    1/2/2011

    2/2/2011

    2/4/2014

    4/10/2015

    5/10/2015

     21/10/2014

];

Thanks

jagan
Partner - Champion III
Partner - Champion III

Hi,

I am not getting the duplicates with below script, I am not sure. 

LOAD * ,

Year(Date) AS Year

INLINE [

    Date

    1/2/2011

    2/2/2011

    2/4/2014

    4/10/2015

    5/10/2015

     21/10/2014

];

But give a try with below script

LOAD * ,

Year(YearStart(Date)) AS Year

INLINE [

    Date

    1/2/2011

    2/2/2011

    2/4/2014

    4/10/2015

    5/10/2015

     21/10/2014

];

Anonymous
Not applicable
Author

Hi Jagan ,

Thanks for reply !

In script i am also not getting duplicate values .But i want to achieve it from list box expression.

Thanks

jagan
Partner - Champion III
Partner - Champion III

Use the same in listbox expression.