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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
smilingjohn
Specialist
Specialist

expression

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

1 Solution

Accepted Solutions
Kushal_Chawda

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'))



View solution in original post

5 Replies
marcus_sommer

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

smilingjohn
Specialist
Specialist
Author

Hi Marcus,

Thanksn for the reply ..It will be really helpfull if you can give me an example .

Thanks

marcus_sommer

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

Kushal_Chawda

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'))



sanjay006
Creator
Creator

Refer this !