Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
stsau
Frequent Visitor

date.addYears showing "right paren expected" in IF statement

Hi Expert,

 

based on a condition I want to create a new data column by adding 1 year to an existing column.

My (simple) formula is

 

= if ( ([Portfolio]="IAM") then Date.AddYears([End of Committed Support],1) )

 

 

customColumn.png

 

The Date function is giving an error, open/close parenthesis should be OK.
Why am I getting the error?

1 ACCEPTED SOLUTION
Jimmy801
Community Champion
Community Champion

Hello @stsau 

 

I didn't see that you used parents parenthesis for the if-syntax. the syntax is     if check then true else false

 

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

View solution in original post

4 REPLIES 4
Jimmy801
Community Champion
Community Champion

Hello @stsau 

 

you are missing the else-statement

 

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

thanks for the hint, but unfortunately that doesnt change the error

 

customColumn2.png

Jimmy801
Community Champion
Community Champion

Hello @stsau 

 

I didn't see that you used parents parenthesis for the if-syntax. the syntax is     if check then true else false

 

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

ok, solution is to remove the outer brackets, thanks for your hints

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors