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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Johan-MTM
Helper III
Helper III

Whole number to date

Hi,

The column "souce_published" contain years (year when book are published) but with data type and format as "whole number".

JohanMTM_0-1678731850353.png

But if i change date type to "date" the "souce_published" instead show dates in june/july 1905.

JohanMTM_1-1678731992489.png

And if i also change "format" to years (yyyy) it only show the year 1905.

JohanMTM_2-1678732047908.png

 

Any idea why this is?

1 ACCEPTED SOLUTION
Padycosmos
Solution Sage
Solution Sage

This video, though intended for another topic, illustrates conversion from Number to Date

https://www.youtube.com/watch?v=0sci44xnto0&list=PLApPcvU5-R24K3mbxORV7T3ckVLfDjmHF&index=20

 

View solution in original post

4 REPLIES 4
Padycosmos
Solution Sage
Solution Sage

This video, though intended for another topic, illustrates conversion from Number to Date

https://www.youtube.com/watch?v=0sci44xnto0&list=PLApPcvU5-R24K3mbxORV7T3ckVLfDjmHF&index=20

 

Thank you for your reply. I tried the solution in the video but I get an error message after I convert to text and then try to convert again to Date:

JohanMTM_0-1678776651765.png

 

I needed to go inte Edit query and then do the solution from the video - wkred like a charm!

 

Thanks for the help!

Greg_Deckler
Super User
Super User

@Johan-MTM It is because a Date is a decimal number and the integer portion is the number of days since December 30th, 1990. So, you would want to do something like DATE([source published],1,1)


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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