Latest Enterprise DNA Initiatives

Unexpected expression in SWITCH/TRUE


Attempting to do a basic calculated column that will return whether the transaction is categorized as Income or Expense by determining if the Amount column is positive or negative, using SWITCH/TRUE. I am getting an error message that says ‘Unexpected expression’ when I use the less than (<) or greater than (>) symbols. I’ve seen these used before in Switch/True so I am pretty confused. Here’s the DAX:

Transaction Type = SWITCH(
Transactions[Amount] = <0, “Expense”,
Transactions[Amount] = >0, “Income”,

I imagine this is a really easy fix. Thank you.

Hi @jsailar,

Just a matter of switching the symbols, try this:

Transaction Type =
    Transactions[Amount] <= 0, "Expense",
    Transactions[Amount] >= 0, "Income"

Please note that all 0 values will be seen as “Expense” because that test will evaluate to TRUE first.

That did it. Thanks so much for the quick response, Melissa!