Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
jpt1228
Responsive Resident
Responsive Resident

Julian Date Conversion or Format

Hello, I searched and read the 2 posts about julian dating but I can't get a solution to work.

 

I can either convert the julian date column on my inventory table YYDDD into a calendar date or add a column in my date table which would convert the date to the julian date.

 

In the below example I need 17103 to be April 13 2017 or 4/13/17

 

image.pngimage.png

 

 

1 ACCEPTED SOLUTION

Sorry, my mistake.

 

Please use this instead

 

Column = 
VAR myYear = 2000 + INT(DIVIDE([Julian Manufacture Date],1000))
VAR myDayOfYear = MOD([Julian Manufacture Date],1000) -1
RETURN DATE( myYear,1,1) + myDayOfYear

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

15 REPLIES 15
Anonymous
Not applicable

I'm converting Julian dates in JD Edwards (Oracle DB), and I had to add "1900" to the year portion of the formula.  So this is the working Power Query (M) formula I wound up with:

 

Date.AddDays( #date(Number.RoundDown([Julian Date]/1000)+1900, 1,1), Number.Mod([Julian Date], 1000)-1))

Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @jpt1228

 

THis might be close as a new calculated column

 

Column = 
VAR myYear = INT(DIVIDE([Julian Manufacture Date],1000))
VAR myDayOfYear = MOD([Julian Manufacture Date],1000) -1
RETURN DATE(Year(myYear),1,1) + myDayOfYear

julian date.png 


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

@Phil_Seamark

 

Thanks - But getting an error when I add column into inventory table

 

image.png

HI @jpt1228

 

I think you are missing the top line.  You need the following.

 

column = 


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

@Phil_Seamark Yes, that was it - Works for the Month/Day but the year is showing 1900 not 2017

What is the raw format in Julian for the 1st of Jan, 1900 ?


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

@Phil_Seamark

I see where the confusion came from

 

00001 would be the date code for Jan 1 and could be for both 1900 and 2000 years.

 

The first 2 numbers are the year - 11 could be 1911, 2011, 2111

The next 3 are the day of the year - 001 would always be Jan 1. - 002 would be Jan 2 etc.

 

17001 would intend to be Jan 1, 2017, but could also be Jan 1, 1917.

 

Since this is inventory I have to measure from the date of manufacture to today to calculate how old the inventory is. I was going to convert the 

Sorry, my mistake.

 

Please use this instead

 

Column = 
VAR myYear = 2000 + INT(DIVIDE([Julian Manufacture Date],1000))
VAR myDayOfYear = MOD([Julian Manufacture Date],1000) -1
RETURN DATE( myYear,1,1) + myDayOfYear

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

HI, when I try this formula, I am getting a Token Eof expected errorpower bi julian date.jpg

jpt1228
Responsive Resident
Responsive Resident

Hi @pludlow. Looks like a formatting error on your date see https://community.powerbi.com/t5/Desktop/Token-eof-expected/td-p/27929

Hi @jpt1228, still confused.  I am pulling data straight of JDE and coming out in this format.  I have tried several formulas and

 

none seem to work.  Below is the best one so farpower bi julian date2.jpgpower bi julian date3.jpg

I was able to solve my issue using the formula I used above but reformatting the date

Thanks @Phil_Seamark!

I guess you need to add table name next to "Julian Manufacture Date"



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

well easier to add julian date in calendar table and set relationship on julian date between date and inventory table.

 

It can be handly to have in date table , in case you hve another table with julian dte, you don't need to convert it to date rather use julian date.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

July Newsletter

Fabric Community Update - July 2024

Find out what's new and trending in the Fabric Community.