[SalesForce] Formula to put a date together seperatly Fields “Month” and “Year”

In an custom Oject, that is filled with external market development data I got a picklist field "Month" (Picklist: 1,2,3,4…12) and a picklist field "Year" (picklist: 1990, 1991, 1992… 2020). Each record represents a value for a certain calendar Month. How is it possible to get Salesforce to know that "Year = 2001" and "Month = 5" in one record the period "May 1st 2001 till May 31st 2001" represents. I Need to have Reports and Dashboards showing the market development?

Best Answer

You can follow below steps to create a new Date type formula field

  1. Go to Setup -> Create -> Object
  2. Click on Create new Field
  3. Select Formula from list.
  4. Type Formula Name and Select Date and return type
  5. Type Following in your formula

    DATEVALUE(text( Year__c) & '-' & text(Month__c) & '-' & '01')
    

Reference guide to Date formula

Related Topic