Forum

Removing columns in...
 
Notifications
Clear all

Removing columns in Power BI source file

6 Posts
2 Users
0 Reactions
934 Views
(@pritch01)
Posts: 8
Active Member
Topic starter
 

Lets say I have an excel table with 100 columns and I load this into Power BI, however I only want to use 30 columns.

As the 100 column file is how the data is downloaded from our system I do not want to delete any unwanted columns here, this I will do in Query as the future files will include these columns.

After the file is loaded into query, I transform the data and remove the unwanted columns.

Now I discover the future downloaded files (source data) exclude the unwanted columns however it clearly doesn't match what was originally loaded into Power BI. 100 vs 30 columns.

How can I change the way Power BI/Power Query views the file as I want to now upload the new file now containing only 30 columns, not 100.

Thanks

Paul

 
Posted : 29/03/2023 9:11 pm
(@debaser)
Posts: 836
Member Moderator
 

It will depend on how you removed the other columns. If you removed them explicitly then you'll just need to edit the query to remove the step that got rid of them. If  you used a Remove other columns approach, then you should be fine anyway as you'll just have a Table.SelectColumns step that only names the columns that still exist (assuming there was no previous type changing step).

 
Posted : 30/03/2023 6:40 am
(@pritch01)
Posts: 8
Active Member
Topic starter
 

I have looked in Advanced Editor in query and I selected the columns I wanted and "Removed Other Columns" so there isn't a step that I can see where I actually removed the columns that match those in the source file

 
Posted : 30/03/2023 5:51 pm
(@pritch01)
Posts: 8
Active Member
Topic starter
 

I've had another look and there is Table.SelectColumns step (see attached)Remove-Colums-Screen-Shot.jpg

Which step should I remove as the columns listed are the ones I wish to keep

 
Posted : 30/03/2023 6:00 pm
(@debaser)
Posts: 836
Member Moderator
 

Remove the #Changed Type step - it refers to all the columns.

 
Posted : 31/03/2023 4:52 am
(@pritch01)
Posts: 8
Active Member
Topic starter
 

Thank you, that worked

 
Posted : 01/04/2023 1:03 am
Share: