Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
Can some one help me in converting the numbers to month names?
I want to remove this number and just want to have the month names.
or is there any possibility to just change these numbers to month names.
Initially i used if statement to bring the month names. But i dont know how to replace the numbers with month names. Thank you.
This will also work (and much simpler)
Month('1/' & right([SPEND MONTH], 2) & '/2014') AS Month
because it doesn't matter in what year you place your month, as long as it's a month.
Hi anand, should i do it expression tab or should i load it in the script?
Thank you
In load script is better but you can go for expression also but performance wise add another field in the load script.
Regards
Anand
Hi,
Try like this in script
LOAD
*,
Date(Date#( '201411','YYYYMM' ), 'MMM' ) AS Month
Date(Date#( '201411','YYYYMM' ), 'YYYY MMM' ) AS YearMonth
FROM DataSource;
Hope this helps you.
Regards,
Jagan.
If you want to format this period into a monthname in the UI (straight table or so), see the example in attachment.
BTW uses the same expression as my previous post.
Peter
Month(Date#([SPEND MONTH],'YYYYMM'))
Date(Date#(Period,'YYYYMM'),'MMM') as MonthName
A word of caution: using Date(...,'MMM') to create month field might not be a good idea. While using date(), you get month names right for the field, but the internal number representation still remains a date. In that case, if you try to get back the month number using Num(), you won't. Here comes the advantage of Month() which returns a dual output (number in the backend and text in the front).
Date(Today(), 'MMM') =>Nov
Num(Date(Today(), 'MMM')) =>41947
Month(Today()) =>Nov
Num(Month(Today()) =>11
I always prefer using Month().
Sorry guys nothing is working out here, i tried all the examples.
thanks for the reply.
Try something like below,
Month(Date#(Left(Trim([SPEND MONTH]),6),'YYYYMM'))