/
How do I use Datamart IF condition in SQL Expression?
How do I use Datamart IF condition in SQL Expression?
Question
I would like to calculate a field according to a value of another field in the Datamart but am unable to do so. What is the correct expression?
I tried:
IF(ColumnNumber=1,GrossSales,"")
CASE ColumnNumber WHEN 1 THEN GrossSales END
Answer
The correct way is to use IF:
IF(ColumnNumber="1", GrossSales, 0)
ColumnNumber is text, so use "".
GrossSales is money, so you can't use "", instead use 0.
Related content
Datamart Query Expressions
Datamart Query Expressions
More like this
Configuration Tips - Data Source, Datamart
Configuration Tips - Data Source, Datamart
More like this
Datamarts
Datamarts
Read with this
Datamart Setup - Important Settings
Datamart Setup - Important Settings
More like this
How to Configure a Distributed Data Source or Datamart
How to Configure a Distributed Data Source or Datamart
Read with this
Why can't I query a Boolean column?
Why can't I query a Boolean column?
More like this
Found an issue in documentation? Write to us.