Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
ShowAll Questionssorted byDate Posted
Briana Tucker

# the number of days between the end date of a contract and today.

I am having trouble completing the following Trailhead: Create a formula field that determines the number of days between the end date of a contract and today. This is the formula that I am using:

EndDate - TODAY()

I keep getting the following error when I check the syntax:  Error: Formula result is data type (Number), incompatible with expected data type (Date).
Steven Nsubuga
You need to change the return type of your formula to a Number instead of a Date
Briana Tucker
If I select number instead as the return type I don't have the option to selection contract end date as the insert field option. I am not sure what the formula is supposed to be now.
Steven Nsubuga
I assume that you are doing this trailhead (https://trailhead.salesforce.com/modules/point_click_business_logic/units/formula_fields). If so the instructions in the challenge specifically state that the return type of the formula is a Number. See image below.

Besides EndDate - TODAY()  returns a number, indicating the number of days, between end date and today.
Steven Nsubuga
The formula is correct but it is tagged to a wrong return type. Use the same formula but with Number as the return type.
Ajay K Dubedi
Hi Briana,
I think the issue may be arising due to the decimal places in the return type section.
I'll suggest you change the datatype to the number and make the decimal place as 0.
Then apply the below formula using Advance formula tab:

EndDate-TODAY()

Hope it helps and mark it best if solved.

Thank you,
Ajay Dubedi
i think i found the solution , problem comes when u create a new cotract object , its gives an syntax error .
Do not create any new object "Contract" - use the standard object "Contract"
Create the Formula field and with  "Number" as Datatype & decimal as  "0 " &
Formula as EndDate - TODAY() .  It works just fine.
a.navnit
I have a similar issue with this trail. I have used the correct data type. I can see the result if I create a new Contract record.
this is on the standard object "Contract"

Data type = number
Decimal = 0
Formula = EndDate - TODAY()

Error: The 'Days_Remaining__c' formula field did not return the correct number of days between the contract end date and today.
Any suggestion?
Sachin Saini 49
You First create one record and try with the given Formula and keep decimal equals 0.

EndDate - TODAY()
Sudhir Punukollu
Make sure you created custom field "Days Remaining" of Type formula and not Number. Delete and recreate the field.
Peggy Wai
I ran into the same problem, turns out I created "Days Remaining" as a Number, not Formula that returns a number. I deleted the custom field and created it again, then it worked.
Mahendra Mishra 15
Tough I've done everything fine - Used Created Field on Std CONTRACTS Object, Chose Number as return Type for the formula field, still Not able to clear the Trialhead as getting below error - Challenge not yet complete in My Trailhead Playground 1
We created a contract and expected the 'Days_Remaining' field to show the number of Days Remaining until the contract end date, but it didn't. Make sure your formula subtracts today's date from the contract end date.
Harsh Mangla
I am not getting the end date field or the contract end date field in the insert field.

ravi teja 566
u should add nowdate function no today
Sia Thripio 5682
I having problem with this module and the error i get is
Challenge not yet complete in BSX101
We created a contract and expected the 'Days_Remaining' field to show the number of Days Remaining until the contract end date, but it didn't. Make sure your formula subtracts today's date from the contract end date.
Sia Thripio 5682
Why this the correct formula for Days_Remaining

EndDate  -   TODAY()

There is No syntax errors in merge fields or functions. (Compiled size: 28 characters)

Sia Thripio 5682
How do i reply to the comment by ravi teja 566 saying that u should add nowdate function no today?

Sia Thripio 5682
U guys will not believe me if I say i am stuck 7 times for formula error and other errors with this seems to be so easy module https://trailhead.salesforce.com/content/learn/modules/point_click_business_logic/formula_fields
Egor Apaniuk
Report builder says, that formula is working correctly, but challenge doesn't think so. Idk, none of the above tips helped ¯\_(ツ)_/¯
Pranitha Reddy 4
I am getting the same error. I have choosen the existing Contract object and decimal as '0' and the data type as Number. The formula inserted is the choosen field EndDate - Today(). dont know why this error... pls help

Hi All,

I was getting the same error trying 3-4 times then here is something I tried-
1) Created a new Playground and launched it.

2) Opened the Contract object>>Created the field "Days Remaining" type "Formula" and return type "Number" with decimal '0'.

3) In the Fomula logic section used- EndDate  -   TODAY()

4) Assign to all profiles and to the page layout and save

5) Check the challenge hope that solves the issue

Tarak Anu 7
I was getting the same error. Then, I tried this trailhead in a new org and that resolved the error.

Hope this helps :)

Muhamamd Irfan
Hi All,
If you are configuration is fine as mentioned in the post and still having the below error so just create a new playground or configure all steps in the different playground. Hope it will work.
Data type = number
Decimal = 0
Formula = EndDate - TODAY()

Jacob Sanchez
Can confirm making a new playground and submitting the exact same formula allowed me to pass it.
Sanowar Hossain
Yes This tell right path
Sanowar Hossain
*person
Joan Aparicio
Hello, anyone has found another way of making this work? It seems a bit overkill generating a new playground...

Cheers!
Joan Aparicio
Hey, found out why I was having that issue, it was due to a validation rule I created over the Account object. Disabled it and now works like a charm, silly me!
I've tried myself numerous times and faced numerous times as an issue /error. But i've finished the challenge. Try to use another org to complete the step / challenge. it's working.

EndDate  -   TODAY()

Steps i've followed. ---> tried with another trailhead org  playground/

SALMAN S H
It also happened same issue with me.Try it in another org or new org. Thanks.
Şükrü Erdinç
Sudeep Singh
When Contract Status is "Activated" then the Next Order Date field must show the immediate wednesday date then after one month of that field date that should updated with +30 days immediate wednesday. For example :- Let's say Contract is "Activated" on 19/01/2023 then Next Order date field will display 25/01/2023. After one month of 25/01/2023, Next order date will display 01/03/2023. Logic is Activated date to immediate wednesday. Immediate wednesday date + 30 to wednesday date.
Sandy Smith 3
I was using this (TODAY() - End_Date__c) / 86400000. I was expecting that this formula will return the number of days between the specified end date and the current date, including any partial days. The above discussion is helpful; many ways to solve it. https://the2d3dfloorplancompany.com/convert-floor-plan-to-3d/
Krutika Raut 8
You are getting this error because you chose a different data type. You need to choose a number as a data type while creating this.
Data type = number
Decimal = 0
Formula = EndDate - TODAY()
Assign to all profiles and to the page layout and save
Check the challenge and hope that solves the issue.

I would like to submit the following steps in order to pass this task :
1. Create Contract record first ->Click on  App Launcher -->  Search for Contract --> Create new record

2.Create Contract object>>Created the field "Days Remaining" type "Formula" and return type "Number" with decimal '0'.
In the Fomula logic section used:  EndDate  -   TODAY()

Kalpana Solanki
First pay attention to object label "Contact" & "Contract". Select "Contract"
1) Open the Contract object>>Create the field "Days Remaining" type "Formula" and return type "Number" with decimal '0'.
2) In the Fomula logic section use- EndDate  -   TODAY()
Yashwant Kumar Bhushan
It also happened same issue with me. Create new trailhead playground and then try it.
Liran Drabkin

After I checked the formula and tried all the different suggestions here in the chat, the thing that worked was to do the same thing in a different or new playground.