Hi @vnnamz and welcome to the QuickSight community!
So to make sure I understand the full breakdown of what you’re trying to complete, if the metric name equals one of those values and target = 0 or 1, divide actual by target (and then similar if actual is 0 or 1?
If so, there are a few things that may need to be adjusted here.
The first thing to point out, when using the ifelse function, you’ll need to complete it with the ‘else’ part of the formula. So you would not be able to use ‘ifelse’ again following your comma(s) as it would not work as an ‘else’ expression. If you’re trying to use 2 ifelse checks, try separating with ‘AND’ instead of a comma.
Additionally, the mismatched aggregation error is coming from the functions being utilized. Here’s a great article to explore that helps break down proper function usage:
I would suggest try incorporating a sumOver for the target and actuals for the second part of the formula.
It may also make more sense to break this down into a couple calculated fields.
Something that sorts out the ifelse scenarios and assigns a number to each scenario, then you can build a second one that handles the separate division formulas.
Let us know if you have any additional questions