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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
EsgibtkeinBier
Frequent Visitor

Conditionally removing a column

Hi everyone!

 

Want to create a query step* where the first column of a table is removed (and then the rest of the columns get renamed) only if a specific value** inside that table is null. Otherwise, the table is passed to the next step as is.

 

------------------------------------------

This is how I tried implementing it, but please also feel free to propose a solution from scratch instead of correcting the mess I created; since I am pretty new to Power BI don't know how much sense my solution makes in the first place 😂

 

Draft Solution

= if ISBLANK(#"Navigation"{3}[Column1]) then

(Table.RemoveColumns(#"Navigation",{"Column1"}) and

Table.RenameColumns{{"Column2", "Column1"}, {"Column3", "Column2"}, {"Column4", "Column3"}, {"Column5", "Column4"}, {"Column6", "Column5"}, {"Column7", "Column8"}, {"Column8", "Column9"}})
else #"Navigation"

 

(Note that the table comes after a Navigation step so I reference it as #"Navigation" and the value** that gets checked is the third row of the first column.)

 

Thank you very much for your time!

 

 

Notes

* It could also be a function, if that's easier to implement.

** If that value is null, then the whole column is null; however, it's not that this cell has a special importance or anything -

might as well do a check at the column level. Just thought that checking only one value would improve performance.

3 REPLIES 3
technolog
Super User
Super User
technolog
Super User
Super User

Hmmm, then is there any way to move this to another forum?

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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