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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.