Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hi
how i vil get year,month by using subfield function
i wil get ans lik 2015-06 0r 2015-jun
can any one help on this
Suresh
Hi,
If you got the Answer please close this thread by giving correct answer to the reply which helps you in finding the answer.
Regards,
Jagan.
Hi
Try like this
LOAD *, SubField(date,'-', -1) as Month,SubField(date,'-',1) as Year Inline
[
date
2015-06
];
Try this,
Subfield('2015-06','-') as Year
SubField('2015-jun','-',2) as Month
Hi,
can you posted sample data from which you want above output.
Regards
thanks all
its working fyn
Suresh
Why use subfield? QV has a wealth of date functions.
Month(Date#('2015-06', 'YYYY-MM'))
Year(Date#('2015-06', 'YYYY-MM'))
Month(Date#('2015-JUN', 'YYYY-MMM'))
Year(Date#('2015-JUN', 'YYYY-MMM'))
Month() will produce dual values which will sort properly. String mangling will not.
Hi,
Try like this using date function
Month(Date#('2015-06', 'YYYY-MM')) for getting month
Year(Date#('2015-06', 'YYYY-MM')) for getting year
OR
Month(Date#('2015-Jun', 'YYYY-MMM')) for getting month
Year(Date#('2015-Jun', 'YYYY-MMM')) for getting year
Always use Date related functions otherwise there will be issues in sorting .
Hope this helps you.
Regards,
Jagan.
try,
Month(Date#(Field, 'YYYY-MM'))
Year(Date#(Field, 'YYYY-MM'))
or
Month(Date#(Field, 'YYYY-MMM'))
Year(Date#(Field, 'YYYY-MMM'))
Hi,
If you got the Answer please close this thread by giving correct answer to the reply which helps you in finding the answer.
Regards,
Jagan.
Hi
Use the below script.
Derive_Month_Field:
LOAD
*,
Subfield(Month,'-', 2) AS MonthField;
LOAD * INLINE [
Month
2015-01
2015-02
2015-03
2015-04
2015-05
2015-06
2015-07
2015-08
2015-09
2015-10
2015-11
2015-12
];