Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I want to change the color of my scatter plot bubbles based on their fractile(based on sales). I am using the following pece of code in expression:
if ([Total Sale Quantity]<=Fractile(total [Total Sale Quantity],0.20), Red(),
if ([Total Sale Quantity]<=Fractile(total [Total Sale Quantity],0.40), Blue(),
if ([Total Sale Quantity]<=Fractile(total [Total Sale Quantity],0.60), Green(),
if ([Total Sale Quantity]<=Fractile(total [Total Sale Quantity],0.80), Yellow(),
LightRed()))))
But, it is giving me lightRed fr all the bubbles. Please guide me where I am going wrong.
Thanks,
Best Regards,
Condition seems ok, Can you make it in sample?
Hi Rahul, the first part of the comparison is only sales, not the fractile, maybe you are looking for?:
if (Fractile([Total Sale Quantity],0.2)<=Fractile(total [Total Sale Quantity],0.20), Red(),
if (Fractile([Total Sale Quantity],0.40)<=Fractile(total [Total Sale Quantity],0.40), Blue(),
if (Fractile([Total Sale Quantity],0.60)<=Fractile(total [Total Sale Quantity],0.60), Green(),
if (Fractile([Total Sale Quantity],0.80)<=Fractile(total [Total Sale Quantity],0.80), Yellow(),
LightRed()))))
Or there is more than one value for total Sale and needs to be aggregated, ie:
if (Sum([Total Sale Quantity])<=Fractile(total [Total Sale Quantity],0.20), Red(),
if (Sum([Total Sale Quantity])<=Fractile(total [Total Sale Quantity],0.40), Blue(),
if (Sum([Total Sale Quantity])<=Fractile(total [Total Sale Quantity],0.60), Green(),
if (Sum([Total Sale Quantity])<=Fractile(total [Total Sale Quantity],0.80), Yellow(),
LightRed()))))
No, my aim is to color the bubbles based on the sales. If the sales are in the 20 percentile then red and so on.
Sorry, I did not understand your point.
But each dot has only one value for [Total Sale Quantity]? Ie, if there is a value for each month and you select only a year there will be 12 different values for each dot (one for each month) and you need to do some aggregation to return only one value for each dot.
You can copy the chart and transform it to a table, make different expressions with each part of the expression to check the values:
Dimensions:
- The current dimensions of the bubble chart
Expressions:
- [Total Sale Quantity]
- Fractile(total [Total Sale Quantity],0.20)
- Fractile(total [Total Sale Quantity],0.40)
This table shows the values you expected?
No, actually the table is also not showing the correct values. It is also showing me the last condition.
It will be difficult to reach a solution without an image or a sample that can give a tip on how is your data model and what's happening.
Which values shows the table and which values you expected?