vid 1336 -- ERROR in Date column

krrishkrsna

Board Regular
Joined
Jan 31, 2009
Messages
84
Hi


i am using Excel 2013 with Jan 2018 power query version


i was practicing 1336 Excel Magic Trick 1336_ Power Query_ Import Big Data Text Files_ Connection Only or Data Model_.mp4


found the ERROR "we could not parse the input provided as a date value" in Date column


from 1/13/2014 to 1/31/2014.
from 01/02/2014 to 12/02/2014 is in dd/mm/yyyy format but from 2/13/2014 again is in mm/dd/yyyy format


sorry i could not go further down to check errors as taking huge time to move down 'coz of huge number of rows


Changed the locale to en-Us, en-IN (IN-India) but still error


in pivot table placed Date (Row), Web Site (Column) and sum of Quantity, getting correct grand total as shown in vid but dates appearing in pivot table from mm/01/yyyy to mm/12/yyyy only


please give me the solution to correct the errors in Date column

thanks
Krishna
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Ideally you can correct the data source to give you consistent formatting. Failing that -

Assuming the dates are consistent in their formats for all future downloads (e.g. Feb 1 2014 - Feb 12 2014 is always dd/mm/yy and date and month are always 2 characters) I think you'll need to import the column as text and then parse out the portions of the string to convert the text back into dates with if...then statements. The question would be however how you could distinguish 02/03/2014 between Feb 3rd and March 2nd. Perhaps there's another field that would indicate the proper month, or maybe you can get the data source to give you a month name that would resolve the ambiguity?

If you have another field to resolve the ambiguity then you could add a line (depending on your locale) such as

if Table.AddColumn(Text.Range([DateText], 6, 4) = "2014" and
Text.Range([DateText], 4, 2) = "02" and
Number.FromText(Text.Range([DateText], 0, 2)) <= 12 and
Number.FromText(Text.Range([DateText], 0, 2)) >= 2 and
(other field logic to identify correct month)<other logic="" field="">
then Date.FromText("2014-02-" & Text.Range([DateText], 0, 2)
else Date.FromText([DateText]))

(rough estimate of the M code, not exact)</other>
 
Last edited:
Upvote 0
thanks McFuller for your reply.

after importing and combining data into power query, i deleted the last step ChangeType in Query Steps and date column converted to Text format. then i changed date data type by using Locale. all dates are displaying correctly. :)
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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