Forum Discussion
Grouping prices in %
- Anonymous4 years ago
Hi
According to your description, you firstlt need to create a table with a column that has value:
"0-10%", "10-20%", "20-30%","30-40%", ... It will be used for X-axis.- For X-axis = {"0-10%", "10-20%", "20-30%","30-40%", "40-50%","50-60%", "60-70%", "70-80%","80-90%","90-100%"}
Then calculate the percentage, and use SWITCH() to match the percentage name and the count of corresponding percentage:
- Percentage = DIVIDE(MAX('OnlinePrices'[Online Price]),MAX('Products'[Recommended Price]))
- Measure =
var _1=CALCULATE(COUNTROWS('OnlinePrices'),FILTER('OnlinePrices',[Percentage]>=0 && [Percentage]<=0.1))
var _2=CALCULATE(COUNTROWS('OnlinePrices'),FILTER('OnlinePrices',[Percentage]>0.1 && [Percentage]<=0.2))
var _3=CALCULATE(COUNTROWS('OnlinePrices'),FILTER('OnlinePrices',[Percentage]>0.2 && [Percentage]<=0.3))
var _4=CALCULATE(COUNTROWS('OnlinePrices'),FILTER('OnlinePrices',[Percentage]>0.3 && [Percentage]<=0.4))
var _5=CALCULATE(COUNTROWS('OnlinePrices'),FILTER('OnlinePrices',[Percentage]>0.4 && [Percentage]<=0.5))
var _6=CALCULATE(COUNTROWS('OnlinePrices'),FILTER('OnlinePrices',[Percentage]>0.5 && [Percentage]<=0.6))
var _7=CALCULATE(COUNTROWS('OnlinePrices'),FILTER('OnlinePrices',[Percentage]>0.6 && [Percentage]<=0.7))
var _8=CALCULATE(COUNTROWS('OnlinePrices'),FILTER('OnlinePrices',[Percentage]>0.7 && [Percentage]<=0.8))
var _9=CALCULATE(COUNTROWS('OnlinePrices'),FILTER('OnlinePrices',[Percentage]>0.8 && [Percentage]<=0.9))
var _10=CALCULATE(COUNTROWS('OnlinePrices'),FILTER('OnlinePrices',[Percentage]>0.9 &&[Percentage]<=1))
return SWITCH(MAX('For X-axis'[Value]),"0-10%", _1, "10-20%",_2, "20-30%",_3, "30-40%",_4, "40-50%",_5,"50-60%",_6, "60-70%", _7,"70-80%",_8,"80-90%",_9,"90-100%",_10)
The final output:
Best Regards,
Eyelyn QinIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi I have created sample data and uploaded it to Wetransfer. Hope this helps. I also tried your other answer but can't get it to work that way yet.
Please use this link to get the sample data
- mh25874 years ago
Super User
Yup Got it can you please describe the issue and desired output
- mh25874 years ago
Super User
Is this your desire output?
- Gerald234 years ago
Helper I
Hmm no I don't need the grouping in Euro's but i want it in Percentage. I guess for this to work we would need to define what the 100% would be. For this we could use the Recommended price if needed.
- mh25874 years ago
Super User
Could you please give me the logic about percentage ?