Skip to main content

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Skip the ticket, Chat with Qlik Support instead for instant assistance.
cancel
Showing results for 
Search instead for 
Did you mean: 
Chanty4u
MVP
MVP

RE:subfield

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

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

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.

View solution in original post

14 Replies
MayilVahanan

Hi

Try like this

LOAD *, SubField(date,'-', -1) as Month,SubField(date,'-',1) as Year Inline

[

date

2015-06

];

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable

Try this,

Subfield('2015-06','-') as Year

SubField('2015-jun','-',2) as Month

PrashantSangle

Hi,

can you posted sample data from which you want above output.

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Chanty4u
MVP
MVP
Author

thanks all

its working fyn

Suresh

jonathandienst
Partner - Champion III
Partner - Champion III

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.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
jagan
Luminary Alumni
Luminary Alumni

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.



Kushal_Chawda

try,

Month(Date#(Field, 'YYYY-MM'))

Year(Date#(Field, 'YYYY-MM'))


or


Month(Date#(Field, 'YYYY-MMM'))

Year(Date#(Field, 'YYYY-MMM'))

jagan
Luminary Alumni
Luminary Alumni

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.

qlikviewwizard
Master II
Master II

Capture.JPGHi

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

];