Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

need to get Year from Month Name field

Hi Team,

  I am having month field like "May-2017" .Here I need to get the Previous year data. So when I use Year(Month) or any other functions in the  field I am getting numeric values something 20.2K  etc. Kindly let me know how to fix the same

6 Replies
jugrimault
New Contributor III

Re: need to get Year from Month Name field

Hi,

Are you sure it is a date format?

Did you try to cast it?

=year(date#([Month], 'MMM-YYYY'))

sadasiva
Contributor

Re: need to get Year from Month Name field

Hi Jaya Prakash,

Maybe like this

Year(date(<your field name>))

Regards,

Sadasiva

kellymcgrady
Contributor

Re: need to get Year from Month Name field

This is what I use to get all the months in 2017 that I have data for.

Let ProdCurrentYear= Date(Today(), 'YYYY');

sadasiva
Contributor

Re: need to get Year from Month Name field

Hi Jaya Prakash,

We have an option to change the format of the expression from Auto to nuumber in properties->Data->Measures->Expression, this may helps.

Regards,

Sadasiva

OmarBenSalem
Esteemed Contributor

Re: need to get Year from Month Name field

Just change your x-axis as follow:

uncheck continuous:

Capture.PNG

kvanandan1
Contributor

Re: need to get Year from Month Name field

Hi Jaya prakash,

I think the date is in string format, if you require the year value you can use the string function to extract the year alone.

For example right(Month,4) will give the year part alone which you can use it in your calculation.

Community Browser