Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
RGV,
Hope this will help u. Also if you are having different date format than do changes according .
Thanks,
AS
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
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.
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
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
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
];
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
Use the same in listbox expression.