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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
tc5pt
Regular Visitor

Removing columns containing only zeros

I have a cash flow timeline and some columns (representing years) have values of 0 throughout the entire column. There are some columns that contain 0s, but also contain other numbers, which I need to keep.

 

So I am looking to remove columns that contain only a certain value, in this case 0.

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @tc5pt 

As tested, the methods provided by this article should be helpful.

Automatically Remove Empty Columns And Rows From A Table In Excel Using Power Query

 

Best Regards
Maggie

 

Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-juanli-msft
Community Support
Community Support

Hi @tc5pt 

As tested, the methods provided by this article should be helpful.

Automatically Remove Empty Columns And Rows From A Table In Excel Using Power Query

 

Best Regards
Maggie

 

Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

FredLEGUEN
Helper III
Helper III

Hi @Nolock 

 

This code will remove all your empty columns

Col1  Col2  Col3  Col4

   5           7         

  12          10      

 

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Col 1", Int64.Type}, {"Col 2", type any}, {"Col 3", Int64.Type}, {"Col 4", type any}, {"Col 5", Int64.Type}, {"Col 6", type any}, {"Col 7", Int64.Type}}),
    Unpivoted = Table.UnpivotOtherColumns(#"Changed Type", {}, "Attribute", "Value"),
    ColumnName = Table.Distinct(Unpivoted, {"Attribute"})[Attribute],
    Custom1 = Table.SelectColumns(Source, ColumnName)
in
    Custom1

Replace your cells with a 0 by null and like that you will be able to remove your columns with 0

 

Nolock
Resident Rockstar
Resident Rockstar

Hi @tc5pt,

you can do that in the PowerQuery Editor UI as shown on the screenshots below.

 

Capture.PNGCapture2.PNGCapture3.PNGCapture4.PNG

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.