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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

SQL script


Hi,

I have the below sql code.

'F' + right(convert(varchar,datepart(mm, DATEADD(MONTH, -3, Period))),2) + '-' + convert(varchar(3),datename(month, Period)) as FinMonth

which is giving results like

F1-Apr, F2-May.....F12 March.

Is there any way that I can add "year" as well ?... just like F1-Apr13, F2-May13......F12Mar12.

Thanks

Labels (1)
2 Replies
greg-anderson
Creator II
Creator II

'F' + right(convert(varchar,datepart(mm, DATEADD(MONTH, -3, Period))),2) + '-' + convert(varchar(3),datename(month, Period)) + right(text(year(Period))) as FinMonth

Not applicable
Author


Thanks for your reply Greg. Right(text(year(period))) is not working. I tried with right(datepart(year,Period),2) and it is working fine. Thanks anyway!