
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Color by expression in bar chart (if selected average > total average)
Hello.
I have a bar chart that displays the average courses ([Nome Evento]) an employee ([Nome do servidor]) has taken in a given period of time.
I want to color the dots based on whether the average of the selection is greater than the total average or not.
I tried this as an expression in the Colors and Legend tab:
if((Count({$} distinct [Nome Evento]) /GetSelectedCount([Nome do servidor])) > (Count({1} distinct [Nome Evento]) / Count({1} [Nome do servidor])), ARGB(255,0,101,128), ARGB(255,135,32,93))
But it doesn't work. All the dots are always colored by a single color, as seen bellow:
How can I make it look like this:
But with the red color being only the values in which the average of selection is lower than the total average?
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @lailarhc ,
Please find below expression
if((Count({$} distinct Curso) /GetSelectedCount([Nome do Servidor]))
>
(Count( total distinct Curso) / Count( total [Nome do Servidor])), ARGB(255,0,101,128), ARGB(255,135,32,93))
Note : At least more than 1 value to be selected for [Nome do Servidor] field.
Abhijit
keep Qliking...
Help users find answers! Don't forget to mark a solution that worked for you!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @lailarhc,
It's supposed to work. Can you please share sample data??
Abhijit
keep Qliking...
Help users find answers! Don't forget to mark a solution that worked for you!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
try
if((Count({$} distinct [Nome Evento]) /GetSelectedCount([Nome do servidor]))
>
(Count( total distinct [Nome Evento]) / Count( total [Nome do servidor])), ARGB(255,0,101,128), ARGB(255,135,32,93))

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello. I created a table with all the columns I'm using in my project, without any filters applies, and downloaded it as an excel file. Is that what you meant?
The file is attached.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @lailarhc ,
I hope you are looking for the same as below.
Abhijit
keep Qliking...
Help users find answers! Don't forget to mark a solution that worked for you!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello @abhijitnalekar , can you please post the expression you used to achieve this result? Thank you

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @lailarhc ,
Please find below expression
if((Count({$} distinct Curso) /GetSelectedCount([Nome do Servidor]))
>
(Count( total distinct Curso) / Count( total [Nome do Servidor])), ARGB(255,0,101,128), ARGB(255,135,32,93))
Note : At least more than 1 value to be selected for [Nome do Servidor] field.
Abhijit
keep Qliking...
Help users find answers! Don't forget to mark a solution that worked for you!
