Forum Discussion
Anonymous
2 years agoNot applicable
Expression.Error: We cannot apply field access to type Number
Hello, I have two columns and if the value in the second column is in the first column, if it does not pass itself, if it contains values smaller than itself, if it contains values greater than itsel...
- 2 years ago
List.Skip(Expression.Evaluate("{"&[A]&"}"), (x)=>x < [B])
ppm1
2 years agoSolution Sage
Not sure I got all your logic correct, but you can simplify it with this approach (add this code to the pop-up custom column dialog).
let
inputvalue = [B],
inputlist = List.Transform(Text.Split([A], ","), each Number.From(_)),
greaterthanlist = List.Select(inputlist, each _ >= inputvalue),
listmax = List.Max(inputlist),
listmin = List.Min(inputlist),
result = if List.Contains(inputlist, inputvalue) then inputvalue else if inputvalue > listmax then listmin else if inputvalue < listmax then List.Min(greaterthanlist) else null
in
resultPat