Divide by the total per group


#1

Let me first show you what I mean here

In Excel I am doing this to calculate the % breakage on total stones

But in power BI, I cant divide the stones per type of breakage or colour by the total of stones

This is how my data set is looking? maybe its wrong format?

Now my formula in power bi is the following
% Breakage Stones = [Stones]/(calculate(sum(‘Breakage Data’[Total Stones]),‘Breakage Data’[Colour]=“Total”))

Any help will be appreciated, thanks


#2

I think all you all to do it this.

It’s all about understanding the context of the calculation.

% Breakage Stones = [Stones]/
(calculate(sum(‘Breakage Data’[Total Stones]),
FILTER( ALL(‘Breakage Data’ ), ‘Breakage Data’[Colour]=“Total”))

Try this.

Also check out this tutorial to learn a bit more about some of the techniques around this.


#3

thank you so much. still learning a lot