Quicksight bar chart show labels even if not data assigned to them

Hi,

I am using a bar chart and want the same labels to show even if they dont have any data assigned to them.

for example
the data field: colours, contains users colours e.g. blue, green, red, yellow

in the bar chart I want to show how many times users have chosen blue, green, red or yellow.
if a colour has not been chosen I still want to show it on the bar chart as a label

for example the colors field may contain
blue = 5
green = 2
yellow = 3

even though red has not been chosen I still want to see it as a label in the bar chart with the others.

Can you suggest a way I can achieve this please.

Can you create a calculated field that assigns a 0 if the value is null?

New calculated field = coalesce(colours, 0)
Then use the new calculated field in your bar chart instead of the colours field.

2 Likes

Hi @stuartb , for your understanding I am create one table for your query and create a bar chart for me the label is coming for all the colors.

Please have a look if you find any help from this.
image

image

Please go to format and check whether you select the Data Labels or not.

image

Also you can try the @David_Wong solutions .

1 Like

Hi @Biswajit_1993 and @David_Wong, thanks for your responses and examples it is very close to what I need. However, I believe in both your examples field Color has to contain the value Red.
image.png

As this will be a count of the colors chosen, if red has not been chosen by any users then the field Color will not contain the value Red at all.
Therefore I want to somehow add the value Red so it does show up in the bar chart.

The user can only choose from a set range of colors so I know which ones may be missing e.g. user can only choose either blue, green, yellow or red.

I hope this helps.

Stuart

1 Like

Hello @stuartb - You probably need to then do this at the data preparation level to have a color dimension table having all the possible colors and then do a left outer join with the fact table so that the dataset becomes like what both @David_Wong and @Biswajit_1993 is suggesting. That should solve your problem. Unfortunaltely, QuickSight won’t be able to generate or hold data point until and unless it is available in the underlying dataset. Hope this helps!

2 Likes

Hi @sagmukhe I understand now I’ll give it a go.

Thanks!

1 Like