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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
vanessafvg
Community Champion
Community Champion

irritating habit of power query (or maybe i dont get it) - but looks like a bug

If you want to replace all blank values in power query ie either "" or null i usually create a custom column i.e

 

if field = null then "not specified"

else if field = "" then "not specified"

else field

as you can see below this created a custom column 

Capture0.PNG

 

now when i go into edit it the format has changed to a conditional column

Capture.PNG

 

 fine no problem but the issue is always with the "" ie blank field which works fine in the custom column, .  **bleep** then fails because it wants you to put a value in there?

 

anyone else had that?

 

see example below, assoon as you click ok

it fails and if you put "" in it, it just creates around 6 of them which you must delete out of the advanced editor.

Capture2.PNG

 

 





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




1 ACCEPTED SOLUTION

There is some logic behind it: if you create an if ... then ... else statement in the formula, then Power Query doesn't know if the resulting code was created by adding a custom column or by adding a conditional column, however....

 

Edit: in your case, you can adjust your code like:

if [Field] = "" or [Field] = null then "Not specified" else [Field]

 

 

I have another example, which is even stranger:

= Table.AddColumn(PrevousStep, "Custom", each if Date.IsInNextYear([Date]) then "Next year" else null)

Gives you:

 

Add conditional column 2.png

In this case, it is quite obvious that the code couldn't have been created with Add Conditional Column.

 

As a workaround, you can try and create something neutral that forces the Add Custom Column popup to appear.

In this example: concatenate "" to "Next Year":

= Table.AddColumn(PrevousStep, "Custom", each if Date.IsInNextYear([Date]) then "Next year"&"" else null)

 

Specializing in Power Query Formula Language (M)

View solution in original post

5 REPLIES 5
GilbertQ
Super User
Super User

Hi @vanessafvg

 

I know that it can be fustrating, and what I have done in the past is to go into the Advanced Editor and make my changes there when it tries to use the GUI for the Conditional Column.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

sure, thats what i do now, however i hope they fix it soon 🙂





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




I agree, would be easier that way.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

There is some logic behind it: if you create an if ... then ... else statement in the formula, then Power Query doesn't know if the resulting code was created by adding a custom column or by adding a conditional column, however....

 

Edit: in your case, you can adjust your code like:

if [Field] = "" or [Field] = null then "Not specified" else [Field]

 

 

I have another example, which is even stranger:

= Table.AddColumn(PrevousStep, "Custom", each if Date.IsInNextYear([Date]) then "Next year" else null)

Gives you:

 

Add conditional column 2.png

In this case, it is quite obvious that the code couldn't have been created with Add Conditional Column.

 

As a workaround, you can try and create something neutral that forces the Add Custom Column popup to appear.

In this example: concatenate "" to "Next Year":

= Table.AddColumn(PrevousStep, "Custom", each if Date.IsInNextYear([Date]) then "Next year"&"" else null)

 

Specializing in Power Query Formula Language (M)

interesting, thanks @MarcelBeug





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




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.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

March Power BI Update Carousel

Power BI Community Update - March 2026

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