Switch and MAX/MIN values

I am trying to use the switch function with MIN/MAX
I am looking to produce either the max or min values of each warehouse based on a condition.

Essentially:

  • If the {Performance} is “High” then I would like the corresponding {Max Metric} value to display
  • If the {Performance} is “Low” then I would like the corresponding {Min Metric} value to display

Quicksight does not accept this syntax:

switch({Performance},
“High”, {Max Metric},
“Low”, {Min Metric},
“other”)

However, when replacing the {Max Metric} and {Min Metric} with non calculated fields or with strings, Quicksight accepts it.

Any Ideas?

Link to Arena sample data:
warehouse performance

Hi @David_Ako-Bryant ,

The switch function only works for returning String (text) values.

I published a solution in Arena:
warehouse perfomrance - Min Max

Due to the issue that it is not possible to mix aggreagted and non-aggregated measures/dimensions in an ifelse statement, I created a max function and a min function. One of them will be 0 and unnecessary, depending whether the performance is low or high.

//max will be 0 in case of High
max(ifelse(Performance="High", Metric,0))
+
//min will be 0 in case of Low
min(ifelse(Performance="Low", Metric,0))

Best regards,
Nico

2 Likes

Hello Nico.
That worked perfectly.
Thanks for the heads up.

Regards,
David

1 Like