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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
tex628
Community Champion
Community Champion

Power Query M - Table.ColumnsOfType()

Hello, 

I have a scenario where I need to remove all columns of the data type integer from the table.
I need to do this in Powerquery and can not do it manually. 

This is what im currently using:

= Table.RemoveColumns(#"Changed Type",Table.ColumnsOfType(#"Table1", {Int64.Type}))

With this string of code I'm able to remove date or text formatted columns by changing the value from Int64.Type to type text or type date. 

But for some reason when I use Int64.Type it removes both decimal numbers as well as integers. The same happens if i try and use type number. For some reason it seems that Table.ColumnsOfType() is unable to differentiate between the two. 

Does anyone know if this is intended or what the syntax would be if i want to remove just integer columns? 


Also, the above code does not appear to work after you have used the Table.TransformColumnTypes() function on the column. If anyone knows why this is I'm really curious! 🙂

Br,
Johannes


Connect on LinkedIn
1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

HI, @tex628

I also did a lot of testing, It seems that Int64.Type, Percentage.Type, and Currency.Type have no difference with type number in Table.ColumnsOfType().

I'm afraid it is difficult to achieve in Power query for now. If you could do it manually or do it in the datasource.

 

Best Regards,

Lin

 

 

 

Community Support Team _ Lin
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

2 REPLIES 2
v-lili6-msft
Community Support
Community Support

HI, @tex628

I also did a lot of testing, It seems that Int64.Type, Percentage.Type, and Currency.Type have no difference with type number in Table.ColumnsOfType().

I'm afraid it is difficult to achieve in Power query for now. If you could do it manually or do it in the datasource.

 

Best Regards,

Lin

 

 

 

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

I managed to achieve the end goal through a different method, not related to this at all. But it's good to know how it is so thanks for the insight! I hope that this might be implemented in the future as it would be a very helpfull function!

Br,
Johannes


Connect on LinkedIn

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.