Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin 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.
--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}
})
Solved! Go to Solution.
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.
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.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
17 | |
9 | |
8 | |
7 | |
7 |