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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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:
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.