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
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
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.