'How to assign sum() based on field value
I am trying to sum some amounts based on a type column and I am getting the following error:
Mismatched aggregation. Custom aggregations can’t contain both aggregate "
SUM" and non-aggregated fields “SUM(CASE WHEN "amount" < 0 THEN "amount" ELSE NULL END)”, in any combination.
This is the content of the calculated field:
ifelse(
type='refund',
sumIf(amount, amount < 0),
type='sale',
sumIf(amount, amount > 0),
0
)
Is there any way to achieve this conditional assignment in QuickSight by using a Calculated Field?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
