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
Anonymous
Not applicable

Remove Blank Columns

Hello

How can I remove blank columns in Power BI Power Query Editor.

I have a report that returns columns with nothing in.  I can't select columns and remove selected, as future runs of the source report may have data in them and so will want those columns to remain.

I believe it needs to be done via the Advanced Editor Applied Steps, but, I'm not sure how.

Thank you

Ian

1 ACCEPTED SOLUTION
Adescrit
Impactful Individual
Impactful Individual

In Power Query, go to the Transform tab. Then select Transpose (Top-left of screen)

 

Then back to the Home tab and select Remove Rows > Remove Blank Rows (these blank rows were your blank columns prior to transposing)

 

Finally Transform > Transpose once more.


Did I answer your question? Mark my post as a solution!
My LinkedIn

View solution in original post

11 REPLIES 11
mahoneypat
Employee
Employee

You should remove any columns that will never have data, but can you clarify why you want to remove columns that sometimes have data? They would take up barely any file size when empty, and you could handle the nulls in your measures if necessary. What issue are you seeing from sometimes-empty columns?

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

Hi mahoneypat.

I have 10 tables.  When the reports are run in eFront to create the reports, for some reason there are over 100 columns in each table that have Column names like Column 100 up to Column 222 as well as the valid Columns which I require.

When in Power BI I select the Field List in a Table for any of these tables, I am greeted with the columns in alpha order, but my view of them is being hampered by all of these empty columns.  It's a "I can't see the wood for the trees problem"

Adescrit
Impactful Individual
Impactful Individual

In Power Query you can Transpose your table. Then if you filter out / remove blank rows (these were columns prior to the transpose step) before transposing once more to return your table to its original layout.


Did I answer your question? Mark my post as a solution!
My LinkedIn
Anonymous
Not applicable

Hi Adescrit

Thank you

Is this the Transform/Unpivot Columns/Unpivot Columns?

Then would I follow up with Remove Blank Rows, followed by Transform/Unpivot Columns/Unpivot Columns?

Please can you confirm my understanding?

Thank you

Adescrit
Impactful Individual
Impactful Individual

In Power Query, go to the Transform tab. Then select Transpose (Top-left of screen)

 

Then back to the Home tab and select Remove Rows > Remove Blank Rows (these blank rows were your blank columns prior to transposing)

 

Finally Transform > Transpose once more.


Did I answer your question? Mark my post as a solution!
My LinkedIn
Anonymous
Not applicable

Hi Adescrit

Thank you, but...

When I Transpose back to the original format - I have lost all of my column names.

Should I do this step directly after the Navigation Step?

Yes, I don't see a way not to lose them because if you first go from headers to the first row, when you transpose the first column it is not blank (they are the old headers) and the delete blank rows does not find any.

Adescrit
Impactful Individual
Impactful Individual

Yes might be best to try this before the "Use First Row As Headers" step


Did I answer your question? Mark my post as a solution!
My LinkedIn
Anonymous
Not applicable

Many thanks for your help.

I tried it on a copy of the file, whilst awaiting your reply.

Thank you for your rapid responses.

 

It works prefectly !! 😊

amitchandak
Super User
Super User

@Anonymous , filter value <>  null

Anonymous
Not applicable

Hi amitchandak

Thank you, but...

Is this an Applied Step or an option in Power Query Editor?

Will this filter out any blank cell or only columns that have no data with the exception of a Column name?

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.