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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
T_T00
Frequent Visitor

Expression.Error: We cannot convert a value of type Table to type List. Details: Value=[Table]

Hello, I cannot figure out where my error lies. Admittedly, I am pretty new to PowerBI... Many thanks in advance! 

 

 

 

let
source1 = Master1,
source2 = AAA_Grants,
mappingTable = #"AAA_to_CAF_col_map",

// Step 1: Rename specific columns in Table "AAA_Grants" using the mapping
renamedAAA_Grants = Table.RenameColumns(source2, Table.Transform(Table.ColumnNames(source2), each {_ , Table.First(Table.SelectRows(mappingTable, each [OldColumnName] = _))[NewColumnName]})),

// Step 2: Merge Table "AAA_Grants" with Table "Master1" and keep all columns from both tables
mergedTable = Table.NestedJoin(renamedAAA_Grants, {"CommonColumn"}, source1, {"CommonColumn"}, "NewColumn"),
expandedTable = Table.ExpandTableColumn(mergedTable, "NewColumn", Table.Union(Table.ColumnNames(renamedAAA_Grants), Table.ColumnNames(source1)))

in
expandedTable

1 ACCEPTED SOLUTION
watkinnc
Super User
Super User

Yeah, you are trying to Table.Union two lists, for some reason.

 

--Nate


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!

View solution in original post

3 REPLIES 3
watkinnc
Super User
Super User

Yeah, you are trying to Table.Union two lists, for some reason.

 

--Nate


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!
T_T00
Frequent Visitor

Thank you Pat, I am not sure how I can change that? Any advice please? 

ppm1
Solution Sage
Solution Sage

The issue is likely that Table.ColumnNames returns a list of the column names, not a table. 

 

Pat

Microsoft Employee

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors