Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote 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:
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 11 | |
| 11 | |
| 6 | |
| 6 | |
| 6 |