Forum Discussion

MP-iCONN's avatar
MP-iCONN
Icon for Resolver I rankResolver I
4 years ago
Solved

Convert Date to Julian Day

Hello,


I am migrating reports from an old system that is going away to Power BI.  I have one custom combine column measure that converts a date to a Julian Day.  

 

How would I go about converting a date (Invoice Date) to a Julian day?  For example an Invoice Date of 2005-1-13 is converted to 2453383.5 in the old system.

 

 

Any help on doing this with Power Query would be greatly appreciated.

 

Thank you.

 

Chad

 

  • MP-iCONN's avatar
    MP-iCONN
    4 years ago

    Thank you for taking the time to research.  I found out we just needed to add a column that had due days (say 30 for example) and then add that to the invoice date. 

    So I was able to just do this in power query:

     

    Due Date

    = Date.AddDays([Invoice Date],[Due Days])

     

    Thank you again.  

3 Replies

  • MP-iCONN , I went through a few articles and was not able to see Julian date like this, Most of the time it is 5 digit number or first 4 digit as year

     

    So you know the logic behind it?

    • MP-iCONN's avatar
      MP-iCONN
      Icon for Resolver I rankResolver I

      Thank you for taking the time to research.  I found out we just needed to add a column that had due days (say 30 for example) and then add that to the invoice date. 

      So I was able to just do this in power query:

       

      Due Date

      = Date.AddDays([Invoice Date],[Due Days])

       

      Thank you again.  

  • You can do this as a calculated column.

    Inv JDate = Table1[Date] + 2415018.5

     

    Internally, dates are stored as days since December 30th, 1899, so you can take that number plus the Julian day for 12/30/1899.