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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Mann
Resolver III
Resolver III

Handling blank files in Power BI as a Data Source

Hi All,

 

I am using csv file a source to Power BI report. These csv file is coming to Azure blob storage everyday. Some times I am receiving blank file (without even column headers) in blob. When Power BI is refreshed it ends up with error as it could not find the required columns in that file.

 

Can we handle these blanks files with some logic in Power query. Something like if any error happens no refresh of this file should happen or Power query should create a file with column headers only.

 

Thanks

1 ACCEPTED SOLUTION

On solution is to create a query that contains all the correct column names. Then in the csv, remove the promote headers step and append the csv below the other query.  Lastly filter out the original headers from the csv with a simple filter drop down. 

 

You still get the headers, but they come from the manual query, not the csv



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

View solution in original post

3 REPLIES 3

I assume you have some combine files logic in Power Query.  In the query that gets loaded, there will be a step that adds a new column using the standard file function.  You cand edit the query before that step to filter out blank csv files.  You may have to extract the file size to identify the blank files, then filter from there



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

Hi Matt
Thanks for the reply. In my case there is only a single file. Every day if there is any data it gets added to the file by the backend system. I will not face blank file issue again once data is loaded in the file for first time but till that happens it is failing the refresh. So I thought of handling this error in some way in power query.

On solution is to create a query that contains all the correct column names. Then in the csv, remove the promote headers step and append the csv below the other query.  Lastly filter out the original headers from the csv with a simple filter drop down. 

 

You still get the headers, but they come from the manual query, not the csv



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.