Home > Software engineering >  Power Query - Function IF null
Power Query - Function IF null

Time:01-24

I have a specific function in Power Query like this:

let Func_Test = (input) =>
    input/1000   500
in
    Func_Test

The challange is now, that the input can contain null. If this is the case, then I get an error. How can I avoid this directly in the function?

CodePudding user response:

Try

try input/1000   500 otherwise null

CodePudding user response:

If I input null into your function, I get null as a response.

However if I don't input anything, the response is an error message :Expression.Error: 0 arguments were passed to a function which expects 1.

For this latter problem, just make the argument optional:

let Func_Test = (optional input) =>
    input/1000   500
in
    Func_Test
  •  Tags:  
  • Related