Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!View all the Fabric Data Days sessions on demand. View schedule
Morning - I am trying to achieve something that I was hoping would be quite simple in Power Query
I have a large data set and reports already build up, but what I need to do is change $ Net value from a specific Company to 0 for all records.
I would like to filter on Company A and change all $ Net to 0 - ideally without making a new column.
| Company | $ Net |
| A | 340 |
| A | 124 |
| B | 0 |
| A | 765 |
| C | 736 |
| B | 23 |
| A | 123 |
| B | 111 |
| B | 122 |
| A | 666 |
| A | 99 |
| C | 0 |
| C | 3 |
| C | 131 |
| C | 278 |
| C | 989 |
| A | 88 |
| C | 23 |
| C | 98 |
Solved! Go to Solution.
Hello @RobertSk
You can achieve the above scenario using M language in Power Query.
Go to Power Query Editor → select your table.
Select the “$ Net” column.
= Table.TransformColumns(
PreviousStepName,
{{"$ Net", each if [Company] = "A" then 0 else _, type number}}
)
Hope, I answered/resolved your query. Please give some kudos and mark this post as "Accepted Solution" if you find it useful.
Hi Robert, @RobertSk
The best case application in your scenario should be to use Table.TransnformRows. This doesn't create an extra column and creates and if condition as well. I'll leave the image of the ouput and the code for it. Let me know if you need the reference file as well. Thanks!
Code:
let
Source = [SourceTable],
TransformRows = Table.TransformRows ( Source , each _ & [ #"$ Net" = if [Company] = "A" then 0 else [#"$ Net"] ] ),
FromRec = Table.FromRecords ( TransformRows )
in
FromRec
Hi @RobertSk ,
Thank you @RobertSk and @ANVS for the response provided!
Has your issue been resolved? If the response provided by the community member addressed your query, could you please confirm? It helps us ensure that the solutions provided are effective and beneficial for everyone.
Thank you for your understanding!
Hello @RobertSk
You can achieve the above scenario using M language in Power Query.
Go to Power Query Editor → select your table.
Select the “$ Net” column.
= Table.TransformColumns(
PreviousStepName,
{{"$ Net", each if [Company] = "A" then 0 else _, type number}}
)
Hope, I answered/resolved your query. Please give some kudos and mark this post as "Accepted Solution" if you find it useful.
Did you test it? I could not get it to work. I did not think you could refer to a different column within Table.TransformColumns transform operation.
Hi @RobertSk ,
I wanted to follow up and see if you had a chance to review the information shared. If you have any further questions or need additional assistance, feel free to reach out.
Thank you.
Hi @RobertSk
You can use Table.ReplaceValue with appropriate functions for the 2nd and 3rd arguments. Here's an example using your sample table:
let
Source = #table(
type table [Company = text, #"$ Net" = number],
{
{"A", 340},
{"A", 124},
{"B", 0},
{"A", 765},
{"C ", 736},
{"B", 23},
{"A", 123},
{"B", 111},
{"B", 122},
{"A", 666},
{"A", 99},
{"C ", 0},
{"C ", 3},
{"C ", 131},
{"C ", 278},
{"C ", 989},
{"A", 88},
{"C ", 23},
{"C ", 98}
}
),
CompanyAZero = Table.ReplaceValue(
Source,
each [#"$ Net"],
each if [Company] = "A" then 0 else [#"$ Net"],
Replacer.ReplaceValue,
{"$ Net"}
)
in
CompanyAZero
This replaces $ Net with 0 for Company A only.
Does something like this work for you?
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 10 | |
| 9 | |
| 6 | |
| 5 | |
| 3 |