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
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.
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 |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 4 | |
| 4 |