Columns Argument in Table.FromColumns Function - Power Query:
- V E Meganathan
- 6 days ago
- 1 min read
Imagine our source data is a list of lists, where each inner list contains a varying count of numbers.
We need to create a table from this list, with each inner list becoming a column in the table.
In today's post, I will demonstrate different methods to provide values for the Columns argument of the Table.FromColumns function.
Table.FromColumns(lists as list, optional columns as any)
Method 1:
Result = Table.FromColumns(Source)
We can ignore this argument; by default, it will assign column1, column2, and so on as headers according to the number of lists.
Method 2:
= Table.FromColumns(Source, List.Count(Source))
We can specify the number of columns in the columns argument, which will also set the column headers to column1, column2, and so on.
Method 3:
= Table.FromColumns(Source, {"Group1","Group2","Group3","Group4","Group5"})
We can supply column headers in a list format. The number of column headers must correspond to the number of lists.
Method 4:
= Table.FromColumns(Source, type table [Group1 = number, Group2 = number, Group3 = Percentage.Type , Group4 = number, Group5 = text])
This will assist us in assigning the data type for each column.
Method 5:
= Table.FromColumns(Source, Value.Type(Table1))
To inherit the column name and data type from another table, we can utilize this construction.





Comments