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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
srduval
Helper II
Helper II

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 II
Helper II

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 II
Helper II

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.