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

Can I set column types while using Table.ExpandTableColumn?

--QUESTION--
The below code shows two steps used. The first expands columns from table 'Sheets' and the second step sets the data types for the columns.
I wish to be able to join these steps together where the column types could be set while expanding them. How would I go about this?

--CODE--
#"Expanded Sheets" = Table.ExpandTableColumn(#"Previous Step", "Sheets", {"Timestamp", "Reason", "Value", "UOM", "Date", "Time"}, {"Timestamp", "Reason", "Value", "UOM", "Date", "Time"}),

// Additional step to change data types:
#"Changed Type" = Table.TransformColumnTypes(#"Expanded Sheets", {
{"Timestamp", type datetime},
{"Reason", type text},
{"Value", type number},
{"UOM", type text},
{"Date", type date},
{"Time", type time}
})

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Rowboat99 ,

Unfortunately, in Power Query, the actions of expanding a table column and transforming column types are inherently two separate steps. The Table.ExpandTableColumn function is used to normalize nested tables by expanding them into multiple rows and columns, while the Table.TransformColumnTypes function is specifically designed to change the data types of columns. You cannot use one of these functions nested within another.
Also, in my tests, if your data columns are formatted more clearly (e.g., date only, date + time, or time only), Power Query automatically recognizes their data types based on your data format and maintains your original data column types after ExpandTableColumn, so you don't need to manually modify all the columns in general.

Best Regards,
Dino Tao
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

1 REPLY 1
Anonymous
Not applicable

Hi @Rowboat99 ,

Unfortunately, in Power Query, the actions of expanding a table column and transforming column types are inherently two separate steps. The Table.ExpandTableColumn function is used to normalize nested tables by expanding them into multiple rows and columns, while the Table.TransformColumnTypes function is specifically designed to change the data types of columns. You cannot use one of these functions nested within another.
Also, in my tests, if your data columns are formatted more clearly (e.g., date only, date + time, or time only), Power Query automatically recognizes their data types based on your data format and maintains your original data column types after ExpandTableColumn, so you don't need to manually modify all the columns in general.

Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.

Top Solution Authors