Notifications
Announcements
No record found.
Hi Experts,
Can we get month number from date field using calculated field?
For example:
3/23/2015----->3
Please suggest your ideas.
Thanks in Advance.
*This post is locked for comments
Hello,
I'm sorry but that's not possible with Calculated Fields. You will have to develop plugin or javascript to get month number in separated field.
No, it's not possible with calculated fields.
Create calculated field ("Month") in the entity, Data Type should be "Whole Number" and in the Field Type "Edit", then provide the below condition and action.
IF.. THEN
CONDITION (Optional)
ACTION
Set Month to TRIMRIGHT(Now(),7)
Hope this should work.
Hi Madhan,
Thanks for your response.
I followed your steps but i am receiving following error message.
"You can't use Now(),which is of type dateTime,with the current function"
Seeni,
Here is a link that contains calculated field of Whole number storing the value of "# of days" and you case is also similar to storing the whole number but not finding difference between days.
ledgeviewpartners.com/.../using-calculated-fields-in-dynamics-crm-2015
Hope this will work.
It is not possible to get the month from a date field, using calculated field.
I've managed to do so with calculated fields.
First I added a date and time field and set it as 1/1/2000 0:00. Let's say this field's name is DEFAULT_DATE.
Next I've added a calculated field as WholeNumber and calculated it as "DiffInMonths(DEFAULT_DATE, Now()) - 228" to get current month. To extract a month from different field, replace the field name with "Now()" and you should get your data.
The same is with years: "DiffInYears(DEFAULT_DATE, Now()) + 1999" and the result should be this year.
This here is close for getting the current month :
"DiffInMonths(DEFAULT_DATE, Now()) - 228"
where DEFAULT_DATE can be any year with January date (1/1/2000 makes checking it easier)
However the 228 is only good for one year and the month you get is off by 1 (Now month - 1). To get the accurate month you could do:
"DiffInMonths(DEFAULT_DATE,Now()) - (DIFFINYEARS(DEFAULT_DATE, Now()) * 12) + 1"
Of course this is a calculated field and you have all of the field refresh limitations.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
SA-08121319-0 4
Calum MacFarlane 4
Alex Fun Wei Jie 2