Power Query max of two values

Naveen Ganpat 26 Reputation points
2021-09-07T12:28:50.847+00:00

Hi all,

Working with PQ and bumped into the following issue:

I want to have the lowest value of either zero or
[column a] divided by [column b] times [variable x] minus [column A]

[variable x] is 0.6 is this example

Currently, I have in one column the following code

= Table.AddColumn(#"Filtered Rows6", "Property_Value", each (([column A]/[column B])*.6)-[column A]) 

and in the next column

= Table.AddColumn(#"Filtered Rows8", "Custom.1", each if [Property_Value] >= 0 then 0 else [Property_Value])

I am trying to change the first row in such a way that I do not need the second column. Please can you help me?

Community Center Not monitored
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ben 61 Reputation points
    2021-09-16T13:29:26.443+00:00

    Does something like this help?

    Table.AddColumn(
        #"Filtered Rows6", 
        "Property_Value", 
        each 
          let 
            Value = (([column A]/[column B])*.6)-[column A] 
         in 
           if Value  >= 0 then 0 else Value
      ) 
    

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.