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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
sjpaq
Helper I
Helper I

Table.TransformColumns Error

I have a powerQuery which combines 2 tables. The resulting table has a few columns that are null as a result of the combine. In one case, I am able to replace the null value with a text value using a the following statement:

 

Now, in another case, I have to replace the null column with a multiplication on 2 other columns. I am trying to use the following statement which results in an error:

= Table.TransformColumns(Source, {"Amount", each if (_ is null and [IndName] = "Response Costs") then ([Hours] * [Hourly Rate]) else _})

 

The error is 

Expression.Error: We cannot apply field access to the type Null.
Details:
Value=
Key=IndName

3 REPLIES 3
PijushRoy
Super User
Super User

Hi @sjpaq 

Can you please try 

 

= Table.TransformColumns(Source, {"Amount", each if [YourColumnName]=null and [IndName] = "Response Costs") then ([Hours] * [Hourly Rate]) else ""})

Or 

Add new column
 = Table.AddColumn(Source, "Amount", each if [YourColumnName]=null and [IndName] = "Response Costs" then ([Hours]*[Hourly Rate]) else ""}

 


Let me know if that works for you


If your requirement is solved, please mark THIS ANSWER as SOLUTION ✔️ and help other users find the solution quickly. Please hit the Thumbs Up 👍 button if this comment helps you.

Thanks
Pijush
Linkedin




Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!





selimovd
Super User
Super User

Hey @sjpaq ,

 

as far as I understand it's not possible to reference other columns in the Table.TransformColumns function:

"It’s important to note that a transformation can only take place on a column itself"

 

But you can add it as a new column and then delete the old one:

= Table.AddColumn(#"Changed Type", "Custom", each if [Amount] is null and [IndName] = "Response Costs" then [Hours] * [Hourly Rate] else [Amount])

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍

Best regards
Denis

Blog: WhatTheFact.bi
Follow me: twitter.com/DenSelimovic

Thank you Denis

I'm very close with your suggestion. The column [Hours] is on the original table, the column [Hourly Rate] is a lookup value set in a previous step (= Table.ExpandTableColumn(#"Merged Queries", "RankHourlyRates", {"Hourly Rate"}, {"Hourly Rate"})) and I cannot reference it in my multiplication. I get the following error.

 

Expression.Error: The field 'Hourly Rate' of the record wasn't found.
Details:
Breach=BR_Cyber Star 2024
Date=2/1/2024
Team Member Name=CTI0
Rank=Capt
Group or Cell=CTI
Activity=Detect
Hours=8

 

any ideas?

 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.