Power Query date to text

cmcreynolds

Active Member
Joined
May 21, 2015
Messages
295
Hello again forum folks -

To obtain a unique identifier, I change a date to text and then concatenate with a name field - all of this within Power Query. I am grabbing the data from about 16 CSV files all in the same structure and no formatting (that I can see?).

For the first (alphabetically) file, PQ keeps the formatting of the date the same (7/7/2015) but for all the other files, it adds leading zeroes (07/07/2015) - even though the date field is without zeroes (7/7/2015)!! :confused:

Does anyone know why PQ is doing this?

Ultimately I want the text file without the zeroes.


Within the same PQ Query editor window (the date field is in green, the text field is the far right column):

With zeroes:

Imgur

Without zeroes:

Imgur
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
I've experienced that PQ isn't too good with "no formatting". It will then apply or assume it's own formats - depending on very small details :-)
So it's best to specifically apply formats before you start querying further.

Re your example - try Date.ToText: There you can specify the desired Output-Format.
 
Upvote 0
I just replaced all the single digits within the column (i.e. "08/" with "8/"). I am on a timeline right now, so it was the only way I could ensure single digits for months. Would mm/dd/yyyy not produce 08/03/2015, too? Anyway, I'll investigate further.

Thanks.
 
Upvote 0

Forum statistics

Threads
1,224,113
Messages
6,176,456
Members
452,728
Latest member
mihael546

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