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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Table.SelectColumns error

I am using Power Query Editor's Custom Column window to attempt the following;

I have Table1 and Table2. I am trying to add a custom column to Table1, that contains Table2 as the value, but only if a value is not null in Table1.

 

 

This code works, it places the table in the new custom column. But it does not include my condition.

 

= Table.SelectColumns(#"Table2", {"Column1", "Column2"})

 

Result = Table2 as a table, with the values within

 

 

This is with the condition added, the result of this code is a null table as the value if [ValueFromThisTable] is not null. Why did it change to a null table when the above code puts in the right table?

 

= if [ValueFromThisTable] = null then null else 
Table.SelectColumns(#"Table2", {"Column1", "Column2"})

 

Result = if the value is null, null. Otherwise, Table2Name as table, with null within

 

 

If someone could please explain to me where I have gone wrong, and why this is happening, I would appreceate it. Thanks

1 ACCEPTED SOLUTION
jbwtp
Memorable Member
Memorable Member

Hi @Anonymous,

 

Assuming that your example is in th econtext of Table.AddColumn() the behaviour is quite weird.

Do you want to try to split the formula to something like:

t2 = Table.SelectColumns(#"Table2", {"Column1", "Column2"}),
t1 = Table.AddColumn(..., ..., each if [ValueFromThisTable] = null then null else t2)

and see if this works Ok?

 

Thanks,

John

View solution in original post

2 REPLIES 2
jbwtp
Memorable Member
Memorable Member

Hi @Anonymous,

 

Assuming that your example is in th econtext of Table.AddColumn() the behaviour is quite weird.

Do you want to try to split the formula to something like:

t2 = Table.SelectColumns(#"Table2", {"Column1", "Column2"}),
t1 = Table.AddColumn(..., ..., each if [ValueFromThisTable] = null then null else t2)

and see if this works Ok?

 

Thanks,

John

Anonymous
Not applicable

Well it turns out I just needed to refresh Power Query Editor, the values have always been there they just were showing null. Found this out after trying your version and multiple variations of each step, one by one until it broke. It always broke once I clicked to view one of the tables to validate the data however an expansion of the table reveals its all there. 

 

Very odd

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.