How to get numeric values to display as date in Power Query?

jplank

Board Regular
Joined
Sep 19, 2012
Messages
62
I am using Power Query and I have a column of dates that's showing up in numeric format. i.e. the values are like "42738" instead of "Jan 4, 2017". How would I go about getting them to display as a date? When I change the type to Date, I get an error.
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Thanks, I've actually already had a look at many of those links. Is there a part in there that you think would help with the issue I'm having?
 
Upvote 0
with you description I don't know the number you show is a text or as number
so you can try change the text-number to the whole number then to date (I assume there is a date only not date time)
check the length, if there is more than 5 you have any hidden character
 
Upvote 0
Hi
Try transformate column with number as text and number as number to date
Code:
let
    Source = #table({"date"}, {{"42738"}, {42738}, {"abcd"}}),
    toDate = Table.TransformColumns(Source, {{"date", each try Date.From(Number.From(_)) otherwise _, Date.Type}})
in
    toDate
if you need not non transformable value in output then replace from otherwise _ to otherwise null
Regards,
 
Upvote 0

Forum statistics

Threads
1,223,809
Messages
6,174,759
Members
452,581
Latest member
ruby9c

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top