Reputation: 125
I am using power query m language. I have created a blank query & written this code
let
Source = #table(
{"first", "second"},
{
{Table.ExpandRecordColumn(Table.FromRecords({[order_id = "a_01", place = "america", price = 700]}), "first", {"order_id", "place", "price"}), "dd"}
}
)
in
Source
Actually I am trying to create a table with code & immediately trying to expand it within first column. But it's showing following error Expression.Error: The column 'first' of the table wasn't found. Details: first
I cannot figure out the problem. Please help me.
Upvotes: 0
Views: 337
Reputation: 5192
Is this what you're trying to do?
let
Source = #table(
{"first", "second"},
{
{Table.ExpandRecordColumn(Table.FromRecords({[first = [order_id = "a_01", place = "america", price = 700]]}), "first", {"order_id", "place", "price"}), "dd"}
}
),
#"Expanded first" = Table.ExpandTableColumn(Source, "first", {"order_id", "place", "price"}, {"order_id", "place", "price"})
in
#"Expanded first"
It gives this output:
Upvotes: 1
Reputation: 4134
first
is not a column the table you passed into Table.ExpandRecordColumn
. Those columns are order_id
, place
, and price
. If you want to expand the first
column in the table you made with #table
, you need to use Table.ExpandTableColumn
and it needs to use the table made with #table
as its first parameter.
Upvotes: 0