Hey @Michael_Paul, welcome to the community!
You’re using SwitchIf()
wrong — particularly, you’re trying to chain it onto a result of the filter, which is not how it works. The syntax isSwitchIf(expr1, val1, expr2, val2,...)
and by chaining it onto a filter, you’re essentially passing the result of the filter (the list of rows) as the first argument expr1
, shifting all other arguments by one i.e. your formula is equivalent to:
SwitchIf(
Table.Filter(...) /* = true */, Table.IsBlank() AND etc // - this what gives you the `true`,
"Both Are Blank", Table.IsBlank()...
)
I understand it, you want to get one row by the filter, and then run this formula on its values?
Then the way to do this is like this:
[DB Blood Etc].Filter(
[Used Name] = "Test Name 1"
).First().WithName(FoundRow, // First() to unwrap the list; WithName to save that row to a variable
SwitchIf(
FoundRow.FnctMin.IsBlank() AND ..., "Both are blank",
FoundRow.FnctMax.IsBlank() AND ..., Concatenate(">", ...)
// etc.
// Note that we read `FnctMin` from `FoundRow`, not from the whole `DB Blood Values`.
// That would return the whole column
)
)
Also could be a good idea to just calculate your switchif within a column of that table for each row using thisRow
and then just return the
[DB Blood Etc].Filter(
...
).ThatColumn
(P.S. Oh blind me, I missed that you already did that)
FYI, chaining a function is almost always equivalent to passing the value before the dot as the first argument to the function, i.e. Something.Function(Arg)
is equivalent to Function(Something, Arg)
. A few notable exceptions are Format()
that ignores chained value, and for some reason Find()
(perhaps it’s like that in Excel, hence the Find(needle, haystack)
but haystack.Find(needle)
.
Oh, I missed that you already solved it. Well, hopefully my answer is still helpful and you can understand CFL better now