Forum Discussion

mattwoldt's avatar
mattwoldt
Frequent Visitor
3 years ago

Power Bi Matrix to sum margin within each row

Hello,

 

sorry wasn't very sure how to word it, but I am trying to do a different type of sum where I am looking at Total Gross Revenue vs Direct Margin by a category:

 

So I have this:

 

 

As you can see there are these types and it has two categories, one being Total Gross Revenue and the other direct margin. Having them sum up by each category is very easy, but what I am trying to do next is do %'s, I want to show Direct Margin / Total Gross Revenue, but when I do ALL() or ALLSELECTED it is not breaking it out by category but instead summing up the entire business making the %'s very low. 

 

What am trying to achieve is when I select a slicer for % or $ it will do a switch, doing ALLSELECTED and dividing that by the "Total Gross Revenue" works perfectly but when I break it down by more categories it is summing up the whole business as opposed to just summing up that product type. 

 

Is there some step that I potentially am missing or some dax code that may help me dynamically sum margin by category? 

 

Thank you!