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
patri0t82
Post Patron
Post Patron

Error Querying Folders of CSV Files Containing Date Column

Hello,

I am querying a SharePoint / Teams folder that contains hundreds (if not thousands) of CSV files. There is a TimeStamp field that contains a value 1/1/0001 12:00:00 AM several times in each file.

Even though I filter it out in my Transform Sample File step, I still receive the error in my main query:

 

DataSource.Error: SharePoint: Request failed: https://xxxx.sharepoint.com/sites/xxxx/Shared Documents/General/xxxx/2020 Temperature Data/04-28-2020/xxxx_csv/_api/contextinfo
Details:
DataSourceKind=SharePoint
DataSourcePath=https://xxxx.sharepoint.com/sites/xxxx
SPRequestGuid=42c5e69f-b047-c000-4eaf-900690c0f13f

 

It seems no matter what I do, that bad date cell is causing problems and I have no way of fixing it. I'm really hoping someone can help with this!

1 ACCEPTED SOLUTION

When you are combining the files in SHarePoint to load, it is doing an automatic Changed Type step. and all of those 0001's  are blocking it.

 

I assume you are using the SharePoint File Combine operation. Disable the Type Detection. Then reconnect and recombine the files.

edhans_0-1629677621349.png

In the Transform Sample query that would be done, make sure there is a Promote First Row as Headers step.

edhans_1-1629677718761.png

Additionally, you could do a find/replace here too. FInd that time stamp and either replace it with null (all lower case - it is a special keyword - or replace it with a legit date. 

Then change the data types.

 

Whatever is done in the Transform Sample File step is done for each file separately before it is passed and added to the Query1 query - the real query you will use in your data source.

What I suspect was happening is it combined some files, the first file was good so it said "That is a date column" but then when it tried to change the type of the 0001 dates, it created an error.

At this point, you should be able to go back to your main query and have no errors - at least now with this particular field. 

 

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

7 REPLIES 7
watkinnc
Super User
Super User

I would change the "Timestamp" column to type text in my transform file, and then use Table.SelecrRows to filter out those rows:

 

= Table.SelectRows(TableOrPriorStepName, each not Text.Contains([Timestamp], "0001"))

Then you can change the type back to datetime.

 

--Nate


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!
PC2790
Community Champion
Community Champion

Look like t=your connection to data source is getting failed from Power BI.

Can you try connecting to the same sharepoint link manually?

And if it is a problem with the date, you will not be able to do it manually as well

Thank you for your response.

I'm not 100% sure I know what you mean, but yes I can access the files within SharePoint and *view only* the CSVs

 

Folder.jpgFile.jpg

 

 

When you are combining the files in SHarePoint to load, it is doing an automatic Changed Type step. and all of those 0001's  are blocking it.

 

I assume you are using the SharePoint File Combine operation. Disable the Type Detection. Then reconnect and recombine the files.

edhans_0-1629677621349.png

In the Transform Sample query that would be done, make sure there is a Promote First Row as Headers step.

edhans_1-1629677718761.png

Additionally, you could do a find/replace here too. FInd that time stamp and either replace it with null (all lower case - it is a special keyword - or replace it with a legit date. 

Then change the data types.

 

Whatever is done in the Transform Sample File step is done for each file separately before it is passed and added to the Query1 query - the real query you will use in your data source.

What I suspect was happening is it combined some files, the first file was good so it said "That is a date column" but then when it tried to change the type of the 0001 dates, it created an error.

At this point, you should be able to go back to your main query and have no errors - at least now with this particular field. 

 

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Thank you for the detailed response - I hadn't thought of adjusting the Data Load configuration. I will give that a try. Your help has been appreciated!

Glad to assist @patri0t82 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Ah forgive me, I tried copying several of the folders to my computer, containing a file that was causing errors, and it seems to be loading fine. 

So if it's not an issue with the date, what kind of connection issue could it be to SharePoint, and are there any solutions that you're aware of?

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.

Top Solution Authors
Top Kudoed Authors