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
Hello,
I am trying to using the dates in the left column and add the months listed in the right column to create a new column. Can someone explain what I’m doing wrong?
Thank you!
Solved! Go to Solution.
Hi @Km93
The issue seems to be a missing else clause.
In M, the syntax of an if expression must be
if <if-condition> then <true-expression> else <false-expression>
For example, if you want to return null when the condition is false, you could write:
if [Contact Frequency] = 1 then Date.AddMonths([Last Contact Attempt],1) else null
See here for more examples/discussion:
hi @Km93 ,
Use this corrected formula to handle the text and numeric parts in Contact Frequency:
if Text.Contains([Contact Frequency], "mo") then
Date.AddMonths([Last Contact Attempt], Number.FromText(Text.BeforeDelimiter([Contact Frequency], " ")))
else
null
It extracts the numeric value before "mo" and applies Date.AddMonths accordingly.
Hi @Km93, Hope your issue is solved. If it is, please consider marking the answer 'Accept as solution', so others with similar issues may find it easily. If it isn't, please share the details.
Thank you.
Hi @Km93, Hope your issue is solved. If it is, please consider marking the answer 'Accept as solution', so others with similar issues may find it easily. If it isn't, please share the details.
Thank you.
Hi @Km93 , Hope your issue is solved. If it is, please consider marking the answer 'Accept as solution', so others with similar issues may find it easily. If it isn't, please share the details. Thank you.
hi @Km93 ,
Use this corrected formula to handle the text and numeric parts in Contact Frequency:
if Text.Contains([Contact Frequency], "mo") then
Date.AddMonths([Last Contact Attempt], Number.FromText(Text.BeforeDelimiter([Contact Frequency], " ")))
else
null
It extracts the numeric value before "mo" and applies Date.AddMonths accordingly.
Hi @Km93
The issue seems to be a missing else clause.
In M, the syntax of an if expression must be
if <if-condition> then <true-expression> else <false-expression>
For example, if you want to return null when the condition is false, you could write:
if [Contact Frequency] = 1 then Date.AddMonths([Last Contact Attempt],1) else null
See here for more examples/discussion:
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 |
|---|---|
| 7 | |
| 5 | |
| 4 | |
| 3 | |
| 3 |