Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
Can someone explain me what the below statement mean ? ( this is written in the srcipt)
Month(MakeDate(left(salesMonth,4),right(salesMonth,2))) AS Date_Sales_Month,
Thanks in Advance
Let's say you have Value like 201705 in salesMonth
left(salesMonth,4) will give you 2017
right(salesMonth,2) will give you 05
MakeDate(left(salesMonth,4),right(salesMonth,2)) -> MakeDate(2017,05) will give you 1/05/2017 (1st May 2017)
Month(MakeDate(left(salesMonth,4),right(salesMonth,2))) -> Month (1/05/2017) will give you May
If you wanna make expression simple use below expression
month(date#(salesMonth,'YYYYMM'))
It takes from a value like 201705 the first 4 chars (year) and the last 2 chars (month) to create per makedate() a date which is then transformed to a month-value of 'May'.
- Marcus
Hi Marcus,
Thanksn for the reply ..It will be really helpfull if you can give me an example .
Thanks
It's logically like the following order - here for demonstration reasons created as preceeding load:
load month(Date) as MonthOfsalesMonth;
load makedate(Year, Month) as Date;
load left(salesMonth, 4) as Year, right(salesMonth, 2) as Month;
load 201705 as salesMonth autogenerate 1;
whereby the above expression will do the same within a single load just nesting those functions.
- Marcus
Let's say you have Value like 201705 in salesMonth
left(salesMonth,4) will give you 2017
right(salesMonth,2) will give you 05
MakeDate(left(salesMonth,4),right(salesMonth,2)) -> MakeDate(2017,05) will give you 1/05/2017 (1st May 2017)
Month(MakeDate(left(salesMonth,4),right(salesMonth,2))) -> Month (1/05/2017) will give you May
If you wanna make expression simple use below expression
month(date#(salesMonth,'YYYYMM'))
Refer this !