Date Conversion to number

  • Date Conversion to number

    Posted by DSC Communities on May 7, 2018 at 10:03 am
    • willie sczech

      Member

      May 7, 2018 at 10:03 AM

      I have SQL database for a legacy system (100M records) where the date is stored as a text number that is the excel date -2. I’d like to create a parameter that allows the user to enter an normal data as “2/4/18” and have PBI convert to the it’s numeric value -2. Any help would be welcome.

      ——————————
      willie sczech
      management analyst
      tdlr
      austin TX
      5124634147
      ——————————

    • Audrey Abbey

      Member

      May 7, 2018 at 1:57 PM

      Can you show an example of the value you would expect for 2/4/2018?
      Not quite following what you want to do.Ā 

      ——————————
      Audrey Abbey
      SR. BI Developer/Analyst
      New Seasons Market
      Portland OR
      ——————————
      ——————————————-

    • willie sczech

      Member

      May 8, 2018 at 7:20 AM

      7/28/2013 = 41483 in excel but = 41481 in legacy db.

      ——————————
      willie sczech
      management analyst
      tdlr
      austin TX
      5124634147
      ——————————
      ——————————————-

    • Guy Shoemaker

      Member

      May 8, 2018 at 8:40 AM

      ?I would try datediff (1/1/1900, parameter, day) – 1 as your formula.Ā  You can look up the definition of DateDiff online.Ā  You do the minus 1 because it is the number of days between your start & end date.Ā  So if you do 1/1/1900 (the base date for Excel) datediff will return 0 but Excel treats 1/1/1900 as 1.Ā  So datediff returns a value already 1 less than the Excel value & subtracting 1 again gets you to your legacy offset of 2.

      ——————————
      Guy Shoemaker
      Application Administrator
      International Capital & Management Company
      St. Thomas
      340-715-5820
      ——————————
      ——————————————-

    DSC Communities replied 7 years, 11 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

The discussion ‘Date Conversion to number’ is closed to new replies.

Start of Discussion
0 of 0 replies June 2018
Now

Welcome to our new site!

Here you will find a wealth of information created for peopleĀ  that are on a mission to redefine business models with cloud techinologies, AI, automation, low code / no code applications, data, security & more to compete in the Acceleration Economy!