Forum Discussion
function logical error
Hi, i kinda get why this error happens but thougt someone might have thoughts insights into the
error problem;
i i start with a true false ;
= let test =( x)=> Number.Round(x) = x
in test
but if i then us ;
if test then "whole" else "decimal"
i get an eroor but i can use ;
= (x)=> if Number.Round(x) = x then "whole" else "decimal"
sorry for the spacing , I could not get code tags to work and the formatting kept goiong all over the plaice.
1 Reply
- tayloramy
Super User
Hi Dicken,
In Power query, functions themselves can't be used as a boolean value. Test is a function, not a boolean itself, so you need to call the function with a value for it to return something useful.
let
test = (x) => Number.Round(x) = x,
result = if test(5) then "whole" else "decimal"
in
result