This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreDid you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now
Need help adjusting formula to only be calculated when the Development Status is "Active-Dev" or "Active-Exe"
Original formula is:
if [Interconnection Facilities ISD] <> null and
Duration.Days([Projected In Service Date] - [Interconnection Facilities ISD]) >= 0 and
Duration.Days([Projected In Service Date] - [Interconnection Facilities ISD]) <= 30 then
"Yes"
else
"No"
Proposed formula is:
If [Development Status] <> "Active – Dev" or "Active – Exe" then null
else
(
[Interconnection Facilities ISD] <> null and
Duration.Days([Projected In Service Date] - [Interconnection Facilities ISD]) >= 0 and
Duration.Days([Projected In Service Date] - [Interconnection Facilities ISD]) <= 30 then
"Yes"
else
"No"
)
receiving error in the 2nd "then" (italicized above)
Solved! Go to Solution.
@rosamhernandez1 , Power query code
= if [Development Status] <> "Active – Dev" and [Development Status] <> "Active – Exe" then
null
else
if [Interconnection Facilities ISD] <> null
and Duration.Days([Projected In Service Date] - [Interconnection Facilities ISD]) >= 0
and Duration.Days([Projected In Service Date] - [Interconnection Facilities ISD]) <= 30
then "Yes"
else "No"
Hi @Zanqueta
You need to check the Development Status first, and then run your original test block inside a nested if…then…else.
✅ Correct M Code
if [Development Status] = "Active-Dev"
or [Development Status] = "Active-Exe" then
if [Interconnection Facilities ISD] <> null and
Duration.Days([Projected In Service Date] - [Interconnection Facilities ISD]) >= 0 and
Duration.Days([Projected In Service Date] - [Interconnection Facilities ISD]) <= 30 then
"Yes"
else
"No"
else
null
---
✔ Why your formula failed
Power Query M doesn’t allow else (condition then … else …)
The correct structure is always:
if … then
if … then … else …
else
…
Also A <> "X" or "Y" is invalid.
Must be written as:
A = "X" or A = "Y"
Hi @rosamhernandez1,
I suggest your adapt using this code:
if [Development Status] = "Active-Dev" or [Development Status] = "Active-Exe" then
if [Interconnection Facilities ISD] <> null and
Duration.Days([Projected In Service Date] - [Interconnection Facilities ISD]) >= 0 and
Duration.Days([Projected In Service Date] - [Interconnection Facilities ISD]) <= 30 then
"Yes"
else
"No"
else
null
If this response was helpful in any way, I’d gladly accept a 👍much like the joy of seeing a DAX measure work first time without needing another FILTER.
Please mark it as the correct solution. It helps other community members find their way faster (and saves them from another endless loop 🌀.
If this response was helpful in any way, I’d gladly accept a kudo.
Please mark it as the correct solution. It helps other community members find their way faster.
Connect with me on LinkedIn
@rosamhernandez1 , Power query code
= if [Development Status] <> "Active – Dev" and [Development Status] <> "Active – Exe" then
null
else
if [Interconnection Facilities ISD] <> null
and Duration.Days([Projected In Service Date] - [Interconnection Facilities ISD]) >= 0
and Duration.Days([Projected In Service Date] - [Interconnection Facilities ISD]) <= 30
then "Yes"
else "No"
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 34 | |
| 31 | |
| 30 | |
| 21 | |
| 16 |
| User | Count |
|---|---|
| 63 | |
| 53 | |
| 31 | |
| 23 | |
| 23 |