Calculate a Classification field in the script and then use that field as dimension in a chart with for example count(distinct Customer) as measure.
And think about what makes a customer an E. GM% below 1 or below 0? There's an overlap in your definition with D.
If(GM%<=0.2 , 'D',
If(GM%<=0.4 , 'C',
If(GM%<=0.5 , 'B', 'A')))) as Classification;
[Actual Sales Amount],
[Actual Cost Amount]
1-[Actual Cost Amount]/[Actual Sales Amount] as GM%