Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi,
I am trying to replace null values in a column with condions but it does not seem to detect null's, I have tried ="", = null and is null with the luck. I am not sure what I am doing wrong. Here is my code.
=Table.ReplaceValue(#"Expanded Column",each [Trial], each if [Trial] = "" and [Date] > #date(2024,1,1) and Text.Contains([Product], "reg prodct") then "Not Required" else [Trial],Replacer.ReplaceText,{"Trial"})
However, even simplifying the code does not work.
= Table.ReplaceValue(#"Expanded Column",each [Trial], each if [Trial] = "" then "Not Required" else [Trial], Replacer.ReplaceText,{"Trial"} )
Of course this works
= Table.ReplaceValue(#"Expanded Column","","Not Required",Replacer.ReplaceValue,{"Trial"})
Anyone tell me what I am doing wrong?
Solved! Go to Solution.
= null is correct. But you have other conditions that may not be true at the same time.
Note : if you always want to replace null with a certain value you can use the coalesce operator ??
Hi @Anonymous ,
Please try this:
Table.ReplaceValue(#"Changed Type",each [Trial],each if Text.Contains([Product],"reg prodct") and [Trial]="" and [Date] > #date(2024,1,1) then "Not required" else [Trial],Replacer.ReplaceValue,{"Trial"})
Change here into ReplaceValue:
The final output is as below:
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
= null is correct. But you have other conditions that may not be true at the same time.
Note : if you always want to replace null with a certain value you can use the coalesce operator ??
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
13 | |
8 | |
8 | |
7 |
User | Count |
---|---|
17 | |
13 | |
7 | |
6 | |
6 |