Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Experts
I have a file that contains months in a numeric format. How can I convert the numeric values into text for the months? (Jan, Feb, e.g.)
Thank you for your help!
Jan
Load *,
text(Date(Date#(fieldname,'MM'),'MMM')) as MonthName
from path;
Hi jan,
In your load script you set the date format = MON/DD/YYYY;
For Month kindly use MON i hope it would help you to convert.. try it.
Regards,
Vignesh
month(MakeDate(2000,YourNUmberFiled))
try to use MONTH(UR FIELD NAME)
Depending on what you're tying to do, you can also use:
pick(your_field_name, 'JAN', 'FEB', 'MAR, ...., 'NOV', 'DEC');
This is assuming your_field_name is a number between 1 and 12.
Regards!
you can use
subfield('$(MonthNames)', ';', yourmonthnumber)
also in the script, example
load
rowno() as Month,
subfield('$(MonthNames)', ';', rowno()) as MonthName
AutoGenerate 12;
MonthNames is defined at the beginning of the script
Another one:
if your values are 1,2,3 etc....
use an expression like this to interpret the numbers as months and then display them in 'mmm' format ( 'Jan','Feb','Mar' ....)
Date(Date#(MonthNumber,'M'),'MMM') as Month
Sample script:
numbers:
LOAD * INLINE [
MonthNumber
1
2
3
4
5
6
7
8
9
10
11
12
];
Dates:
load * , Date(Date#(MonthNumber,'M'),'MMM') as Month
Resident numbers;
drop table numbers;
Load *,
text(Date(Date#(fieldname,'MM'),'MMM')) as MonthName
from path;
hi,
Simply load inline table in data model or join this table
DIS_MONTH:
LOAD * INLINE [
MONTH1, DISPLAY_MTN
1, Jan
2, Feb
3, Mar
4, Apr
5, May
6, Jun
7, Jul
8, Aug
9, Sep
10, oct
11, Nov
12, Dec
];
Awesome! Thank you!