
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
AddMonths function
Hi,
I have a start date 02/15/2017. I need to add number of months to get the end date. Suppose no of months=12 will give me the end date 02/15/2018. The number of months will come from a field. I know the function AddMonths but it's only working when I am giving the number of months explicitly.
AddMonths(date(Subscription_Start_Date__c),12) is working.
But how do I write the function if the number of months is coming from another field?
AddMonths(date(Subscription_Start_Date__c),Subscription_Duration) doesn't work.
Thanks!
- « Previous Replies
-
- 1
- 2
- Next Replies »
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is Subscription_Duration__c a number field is the last thing I can ask you to check.... otherwise I have no idea... Unless you are able to share a sample, I have no idea why it isn't working
Date(AddMonths(Subscription_Start_Date__c, (Subscription_Duration__c * 1))) as test

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Where is this used? May be this:
AddMonths(Date(Subscription_Start_Date__c), Max(Subscription_Duration))

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the script. Gives an error saying invalid expression.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't see why your original expression won't work in the script. Do you have Subscription_Start_Date__c and Subscription_Duration in one table when you are doing this AddMonths calculation???

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How about this?
AddMonths(Date#(Subscription_Start_Date__c, 'MM/DD/YYYY'), Subscription_Duration__c)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Not working

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Why don't you paste the screenshot of the error you have received

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Writing the max function is giving error while reloading the script 'Invalid expression'. Omitting the max function, the field 'test' is not displaying any values.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
can you run your script without this and send a screenshot for the Subscription_Start_Date__c field.... seems like QlikView doesn't interpret as a date field.
Best,
Sunny

- « Previous Replies
-
- 1
- 2
- Next Replies »