Is there any function in quicksight like case function

Case parameter 1
when ‘category’
then {category}
when ‘calculation field’
then {calculation}–>as a dimensions
end

Hi @Ajay1 -

There is no case function but you can achieve the same result using a nested ifelse.

Syntax:

ifelse(if-expression-1, then-expression-1 [, if-expression-n, then-expression-n ...], else-expression)

Example:

ifelse(
${Parameter1}='category',{category},
${Parameter1}='calculation field',{calculation},
NULL)
1 Like

yes i can but i am facing some issue if i use calculation with this and if i use direct dimension and measure there is no issue it is working good

@Ajay1 is category a dimension and calculation a measure? You can’t have different data types in the same calculated field.

If you are using this in a table you can solve by converting your measure to a string. toString({calculation}).