This articles explores the use of logical expressions in Fabric Dataflows / Power Query. Logical expressions are very useful in Custom Columns and dynamic filtering. The following operators can be used:
Operator | Description |
---|---|
> | Greater than |
>= | Greater than or equal |
< | Less than |
<= | Less than or equal |
= | Equal |
<> | Not equal |
or | Conditional logical OR |
and | Conditional logical AND |
not | Logical NOT |
You can use a if – else if expression inside a Custom Column after the each or in any other expression:
let
varUnitPrice = 120.55,
varQuantity = 5,
varLineTotal = varQuantity * varUnitPrice, // 602.75
varOrderLineSize =
if varLineTotal < 100 or varQuantity = 1 then "Small"
else if varLineTotal >= 100 and varLineTotal < 500 then "Medium"
else if varLineTotal >= 500 and varLineTotal < 1000 then "Large"
else "Extra Large"
in
varOrderLineSize // "Large"