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
jamesgauthier
New Member

Remove columns of a table from another query

Hi,

 

In my modelling I need To set some fields from TableA before using them in an Append step to load TableC = A+B.

 

When TableC is loaded, I don't need anymore to keep the originals fields in tableA and would like to delete them for performance issues (i could hide them, but the volume of data if big).

how can i run a Table.RemoveColumns on table A from a query on table B or blank query?

 

Example:

-Load TableA transforming columns from source to obtain field A1 to A6

-Load TableB with Columns B1 to B7

-Load TableC with an Append from TableA and TableB, keeping columns B1 to B3 and A1 to A3

-DELETE COLUMNS A2, A3 ON TableA 

 

I try to run a custom step = = Table.RemoveColumns(TableA,{"A2", "A3"})

but if I do it from tableC query… it deletes the columns on TableC, and if I do it from a blank query, it creates a copy of TableA with the columns A2 and A3 removed

 

 

Any idea on how to, generally speaking, apply a M transformation from one query to another table?

2 REPLIES 2
Stachu
Community Champion
Community Champion

are tables A & C both loaded to the model? if only table C is loaded, then you don't need to remove the columns at all

how I would do what you need (assuming A & C are loaded to the model)

1) duplicate table A, name it A_full, disable the load to the model for it

2) in table A change the query to referencing A_full, remove the columns there

3) table C should be now C=A_full+B



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

v-xjiin-msft
Solution Sage
Solution Sage

@jamesgauthier

 

Per my understanding about your requirement. Since your table C is appended by table A and table B. It also means that your table C is using the columns on table A. Thereby when you want to remove table A columns (A2 or A3). Of course it will delete the corresponding columns on table C.

 

By the way, I’m not quite understand about your requirement. Why do you want to remove columns? Could you please elaborate your requirement with sharing us more information like your table structure and some sample data.

 

Thanks,
Xi Jin.

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.