cancel
Showing results for 
Search instead for 
Did you mean: 
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 a 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 a 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 a Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

Top Solution Authors