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
JortBreij
Helper I
Helper I

Need help adding a calculated column

I want to add another column in my table with true or false.

It's really simple I thought. This is what I had in power query editor:

 

= Table.AddColumn(Incidents_table, "SlaBehaald",
each if(
Incidents[completionDate] < Incidents[slaTargetDate],
true,
false
))

 

So if the completiondate is earlier then the slaTargetDate, then it should be true, otherwise false.

Instead is shows the token rightparen expected error.

powerbi error.PNG

1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@JortBreij,

 

Rewrite the "if" statement as follows:

 

if [completionDate] < [slaTargetDate] then true else false




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
AndrewDavies
New Member

Your formula would work in DAX but power query uses M language. If you want to write an if statement then the syntax would be:

if [completionDate] < [slaTargetDate] then true else false

 

Make sure the "if" is all lowercase. Hope this helps 🙂 

johnt75
Super User
Super User

I don't think you need "Incidents" before the column names

DataInsights
Super User
Super User

@JortBreij,

 

Rewrite the "if" statement as follows:

 

if [completionDate] < [slaTargetDate] then true else false




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.