Using a calculated field as x axis on vertical bar chart

Hi,

I am trying to create a calculated field that tells me ‘LOW, MEDIUM or HIGH’ BASED on the percentile 30, and 70 of a column in the dataset.

I have a column named TASA_ORDINARIA in the dataset of Decimal type. As shown below:

image

I am creating a calculated field with the following code. It works fine:

ifelse(
firstValue({TASA_ORDINARIA},[{TASA_ORDINARIA} ASC],[{TASA_ORDINARIA}]) > percentile({TASA_ORDINARIA}, 30)
, ifelse(
firstValue({TASA_ORDINARIA},[{TASA_ORDINARIA} ASC],[{TASA_ORDINARIA}]) > percentile({TASA_ORDINARIA}, 70)
, ‘ALTA’
, ‘MEDIA’
)
, ‘BAJA’
)

Basicly if the TASA_ORDINARIA of that row is below percentile 30 it will prompt BAJA if is between percentile and 30 return MEDIA and greater than percentile 70 is ALTA.

So far so good.

Now I want to create a vertical bar chart using this calculated field but I am getting this error:

The idea is that I am categorizing every row in 3 clases: BAJA, MEDIA and ALTA and now I want to see the MONTO (amount) of every class grouped by PRODUCTO

Thanks in advance

Hi,

does the calculated field needs to react to filters?

If not, you could create the calculated field in the dataset. This way it should be recognized as a normal field in the analysis and can be used as a dimension.

1 Like

Hi, @thomask

calculated field does not need to react to filters.

Tried creating the calculated field in the dataset.

image

but still getting the same error trying to use it as a dimension:

Hi @Enrique_Martin

Like it says you can’t have aggregations as a dimension.

I would suggest trying to do this in sql if you can.