Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Hi
I have a powerquery function adding a new column with some conditions:
= Table.AddColumn(#"Changed Type2", "(C) Enrolled", each if [#"# Enrolled - Copy"] = "NULL" then 0 else if [#"# Enrolled - Copy"] = "TERM" then 0 else if [#"# Enrolled - Copy"] = "DATA" then 0 else if [#"# Enrolled - Copy"] = "SI" then 0 else [#"# Enrolled - Copy"])
I would like to build another condition into this:
IF [Duration COLUMN] is not blank then return 0 in the (C) Enrolled column
I have tried something like this, but can't get it to work
= Table.AddColumn(#"Changed Type2", "(C) Enrolled", each if [#"# Enrolled - Copy"] = "NULL" then 0
else if [#"# Enrolled - Copy"] = "TERM" then 0
else if [#"# Enrolled - Copy"] = "DATA" then 0
else if [#"# Enrolled - Copy"] = "SI" then 0
else if [#"# Enrolled - Copy"] = null AND [Duration COLUMN] IS NOT BLANK then =0
else [#"# Enrolled - Copy"])
Solved! Go to Solution.
If by "blank" you mean null, then try updating the line to
else if [#"# Enrolled - Copy"] = null and [Duration COLUMN] <> null then 0
Note that M is case-sensitive so you need to use "and" instead of "AND".
If [Duration COLUMN] has different types of blanks like the empty string "" or white space " ", then use those instead of null above.
If by "blank" you mean null, then try updating the line to
else if [#"# Enrolled - Copy"] = null and [Duration COLUMN] <> null then 0
Note that M is case-sensitive so you need to use "and" instead of "AND".
If [Duration COLUMN] has different types of blanks like the empty string "" or white space " ", then use those instead of null above.
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 5 | |
| 5 | |
| 4 | |
| 4 | |
| 4 |