Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
yzhang88
Contributor III
Contributor III

How to give dynamic color in Histogram chart

Hi All, can someone help me to figure out the expression in Background Color section? I want to get something like this

Color2.PNG

So I create a histogram to show the distribution of sales for each customer. In dimensions, I use calculated dimension, class(aggr(sum(sales),customerID), 1000). The measurement/expression is count(distinct customerID). Then I got a histogram like above, now I want to show in histogram that x-axis value <5000 with red, otherwise green. Can someone help me with the expression in Background Color?

for example: IF (aggr(sum(sales),customerID)<5000, red(), green()) --this expression doesn't work

Thanks.

1 Solution

Accepted Solutions
dplr-rn
Partner - Master III
Partner - Master III

dont think additional aggr would work as you have bucketed it already.

i am assuming you want to mark each bucket where sum(Sales) for each customer is less than 5000

one work around would be to calculate average sale prize for each bucket which should satisfy the condition you want. something like

if(sum(Sales)/count(DISTINCT Customer)<5000,red(),green())

hope it works out

View solution in original post

6 Replies
dplr-rn
Partner - Master III
Partner - Master III

can you share a sample app?

yzhang88
Contributor III
Contributor III
Author

Sorry, I think I can't due to company policy. Any questions I can answer?

sergio0592
Specialist III
Specialist III

Scrambling option available in Document properties/Scrambling.

dplr-rn
Partner - Master III
Partner - Master III

dont think additional aggr would work as you have bucketed it already.

i am assuming you want to mark each bucket where sum(Sales) for each customer is less than 5000

one work around would be to calculate average sale prize for each bucket which should satisfy the condition you want. something like

if(sum(Sales)/count(DISTINCT Customer)<5000,red(),green())

hope it works out

yzhang88
Contributor III
Contributor III
Author

This workaround looks working for my purpose. Thank you Dilip.

dplr-rn
Partner - Master III
Partner - Master III

no problem. glad it worked out