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
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
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.