cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Need help with conditional column

I cannot seem to get the last part of this query

 

Excel

=IF([@[PT reporting change]]="after change",[@[PT 2]],IF([@[PT/NPT]]="PT",IF([@activity]="NONOPS",0,[@DURATION]),IF(OR([@operation]="saftey",[@operation]="commute",[@operation]="lunch"),[@DURATION],0)))

 

Power Bi-Power Query

if[PT Reporting Change]="AFTER CHANGE" then [PT2]
else if ([activity]="NONOPS" and [#"PT/NPT"]="PT") then 0
else if ([operation]="safety" or [operation]="commute" or [operation]="lunch") then [DURATION] else ""

1 ACCEPTED SOLUTION
Super User III
Super User III

Here's how your code looks like after playing with it in Powerqueryformatter.com

 

  if [PT Reporting Change] = "AFTER CHANGE" then [PT2]
  else if ([activity] = "NONOPS" and [#"PT/NPT"] = "PT") then 0 
       else if ([operation] = "safety" or [operation] = "commute" or [operation] = "lunch")    then [DURATION]
            else ""

 

Your return values can be [PT2], 0, [Duration], or "" .  That's not really cool.  You want to decide on a column type and then adjust the return values accordingly.

View solution in original post

1 REPLY 1
Super User III
Super User III

Here's how your code looks like after playing with it in Powerqueryformatter.com

 

  if [PT Reporting Change] = "AFTER CHANGE" then [PT2]
  else if ([activity] = "NONOPS" and [#"PT/NPT"] = "PT") then 0 
       else if ([operation] = "safety" or [operation] = "commute" or [operation] = "lunch")    then [DURATION]
            else ""

 

Your return values can be [PT2], 0, [Duration], or "" .  That's not really cool.  You want to decide on a column type and then adjust the return values accordingly.

View solution in original post

Helpful resources

Announcements
secondImage

Happy New Year from Power BI

This is a must watch for a message from Power BI!

December Update

Check it Out!

Click here to read more about the December 2020 Updates!

Community Blog

Check it Out!

Click here to read the latest blog and learn more about contributing to the Power BI blog!

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors
Top Kudoed Authors