Changing name of data label points

I am trying to change the names of my data label points on the y axis from 1, 2, 9 to yes, no, unknown. I can’t work out how to do this. Any assistance would be appreciated. Thanks

You have to create a calculated field to change those numerical values to string values.

Example:
ifelse({value} = 1, ‘yes’, {value} = 2, ‘no’, {value} = 9, ‘unknown’, null)

Then put your calculated field on your y-axis.

Thanks David. I’m very new to QuickSight (having more experience with Power BI). Do I create the calculated field as a new field in my dataset, or is that something I can do on the visual itself?

You can create the calculated field either in your analysis or dataset.

In your analysis:
image

In your dataset:
image

Either way, the syntax is the same:
image

If you use the same dataset in multiple analyses, you can consider putting the calculation in your dataset so that you only have to perform it once. Otherwise, doing it at the analysis level works just fine.

Thanks David,

I seem to keep getting a syntax error even though I’m following your instructions:

image

Not sure what I’m doing wrong.

The syntax looks fine to me. The only thing I can think of is that maybe {42Arrivebyambulance} in your dataset is a string and not a number. Can you check that?

I can’t actually view the dataset. Another team member imported it and now it seems the other two team members who are developing the dashboards, can’t actually view it. I’ll wait till everyone is back to work (after the Christmas/New Year holiday) and check it then.
The only thing I can see from the analysis screen is that 42Arrivebyambulance is a text field.
image
Thanks so much for your help.

If it’s a text field, you have to put single or double quotes around your values in your calculation.

ifelse(
{42Arrivebyambulance} = ‘1’, ‘yes’,
{42Arrivebyambulance} = ‘2’, ‘no’,
{42Arrivebyambulance} = ‘9’, ‘unknown’,
null
)

Now it’s giving me the error on null
image

I’ve tried it by both typing the word null, and also using the null function. Same error both times.

And also using both single and double quotation marks around my values.

You’re missing a comma after ‘Unknown’. :slightly_smiling_face:
I wish the error messages were more helpful.

Yay, that worked!
Now I guess I’m going to need another calculated field to get them in the order I want i.e. Yes, No, Unknown (rather than alphabetical like it is right now)?
image

Yeah, now you need a numerical field to sort by. If there isn’t one in your dataset, you have to create one.

To change the default sort order in your bar chart, select “Sort options”.

Select the field you want to sort by and set the aggregation to “Min”.
image

Great, thanks again for all of your help. :slight_smile: