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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
srduval
Helper III
Helper III

Change All Column Types In a Datflow dynamically

I have a report that I am trying to create via a dataflow, where I take a query result from SQL and transpose the data, but this leaves all the columns as an undefined type and the dataflow is wanting all the columns to be of a determined type. The number of columns will change month to month, so I can't explicitly convert them all to text, is there a formula or something I can use in the dataflow power query editor?

1 ACCEPTED SOLUTION
srduval
Helper III
Helper III

Found this post that seems to do the trick

Solved: Change data type of all columns in a table - Microsoft Fabric Community

 

let Source = Excel.CurrentWorkbook(){[Name="YourTable"]}[Content],

LSTHeaders = Table.ColumnNames(Source),

HowMany = List.Count(LSTHeaders),

Transformation = Table.TransformColumnTypes( Source, Table.ToRows(Table.FromColumns({LSTHeaders, List.Repeat({type number}, HowMany )}))) 

View solution in original post

1 REPLY 1
srduval
Helper III
Helper III

Found this post that seems to do the trick

Solved: Change data type of all columns in a table - Microsoft Fabric Community

 

let Source = Excel.CurrentWorkbook(){[Name="YourTable"]}[Content],

LSTHeaders = Table.ColumnNames(Source),

HowMany = List.Count(LSTHeaders),

Transformation = Table.TransformColumnTypes( Source, Table.ToRows(Table.FromColumns({LSTHeaders, List.Repeat({type number}, HowMany )}))) 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.