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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
DagmaraG
Frequent Visitor

Error in Date Field

Hi all!!

 

I have a really strange case.

My datasource is Google Sheet with many data (like 1 mln) for multiple dates.

While loading it to Power BI I am geeting errors on Date fields.

 

Why is that? Because in one case data field in alligned to right and on the other to left.

DagmaraG_0-1684496347099.png

 

DagmaraG_1-1684496432019.png

 

DagmaraG_2-1684496488444.png

 

 

Is this even possible to have this kind of error based on formating?

2 REPLIES 2
collinsg
Super User
Super User

Alignment to the left indicates the data is text. Alignment to the right indicates the data is numeric or datetime. The date of 8th October likely has spaces preceeding or following it which leaves it being interpreted as text. The following will convert all rows to datetime. It works by

  1. Testing the type of the raw date to see if it is datetime.
  2. If it is datetime then return the raw date.
  3. If it is not datetime assume it is text.
    1. Trim the text and
    2. Convert it to datetime.
= Table.AddColumn(
#"Name of Previous Step",
"Datetime", each
if ( Type.Is( Value.Type([Raw Date]), DateTime.Type) )
then [Raw Date]
else DateTime.From( Text.Trim([Raw Date]) ),
type datetime)

 Here is my Google Sheet,

collinsg_1-1684567349149.png

and  here is my result in Power Query (I am working in UK local so my date format is day, month, year).

collinsg_0-1684567329365.png

 

AjithPrasath
Resolver II
Resolver II

Hi,

  It may be some space issue. Try trim(inside the format) in the column.

AjithPrasath_0-1684502613389.png

 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors