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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

master calendar?

'FY' & Right(Year(AddMonths([CreatedOn],-6)),2) & '/' & Right(Year(AddMonths([CreatedOn],6)),2) AS [Financial Year],

pls explain me  (AddMonths([CreatedOn],-6)),2         what -6 do here?    full expression clearly

Labels (1)
1 Solution

Accepted Solutions
its_anandrjs
Champion III
Champion III

Hi,

By AddMonths([CreatedOn],-6)) expression we go back 6 months back it would be like in [CreatedOn] date this function less 6 months and give out put

Ex:- if date is 30/10/2014 it will show 30/4/2014

And in this line Right(Year(AddMonths([CreatedOn],-6)),2)  it calculate Year(AddMonths([CreatedOn],-6)) and then from right 2 values that is YY is fetched.

Same is going on the other expression.

Regards

Anand

View solution in original post

9 Replies
sushil353
Master II
Master II

Hi,

AddMonths([createdOn],-6) will take you 6 months back..

say if today is month of October-2014 and if I apply above formula then it will return April-2014..

HTH

Sushil

Not applicable
Author

(AddMonths([CreatedOn],-6)),2)   what about 2 here

its_anandrjs
Champion III
Champion III

Hi,

By AddMonths([CreatedOn],-6)) expression we go back 6 months back it would be like in [CreatedOn] date this function less 6 months and give out put

Ex:- if date is 30/10/2014 it will show 30/4/2014

And in this line Right(Year(AddMonths([CreatedOn],-6)),2)  it calculate Year(AddMonths([CreatedOn],-6)) and then from right 2 values that is YY is fetched.

Same is going on the other expression.

Regards

Anand

danieloberbilli
Specialist II
Specialist II

the months are going backwards: not added but back in time (-6 months)

Not applicable
Author

Hi,

If you are looking for Master Calendar.

Follow the below link.

http://community.qlik.com/blogs/qlikviewdesignblog/2012/10/16/the-master-calendar

its_anandrjs
Champion III
Champion III

From right 2 values that is YY is fetched.


Regards

Anand


Not applicable
Author

it means 2014     so it is going to  fetch 14 only right?

its_anandrjs
Champion III
Champion III

Yes right..

Regards

Anand

jagan
Partner - Champion III
Partner - Champion III

Hi Manoj,

Check this

Right(Year(AddMonths([CreatedOn],-6)),2)


- AddMonths([CreatedOn],-6) will give you the date past (subtract) 6 months from created on date,

For example AddMonths(Today(), -6) will give you 4/30/2014

- Year(AddMonths([CreatedOn],-6)) - Year() will give the year for the above date

Right(Date, 2) - will give you the right most characters in the date, ie, 2014


Instead you can simply do this by using


Date(AddMonths([CreatedOn],-6), 'YY')


Hope this helps you.


Regards,

Jagan.