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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Replace null values in text with condition on other columns

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?

 

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

= 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  ??

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

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:

vjunyantmsft_0-1709090338064.png

 

The final output is as below:

vjunyantmsft_0-1709090173929.png


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.

lbendlin
Super User
Super User

= 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  ??

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.

Top Kudoed Authors