Matrix calculations - different sums at different levels of hierarchy

Hi there,

I wonder if you could help me on this please?

I have a power BI file where I have information in a matrix for stocks split into valuations per case as at a month end date. It is necessary to be able to select multiple customers within a Case and multiple months to look at the data - however the data is valid as at month end for each month.

Each stock has a Classification and sub-Classification as well as a code.
I have an SV = Stock Value for each Stock
I also have an ASV = Australian Stock Value (the total for all Australian Shares in that customer for that month) and a
TPV = Total Portfolio Value (the total of ALL shares for that customer for that month).

The thing I need to do is calculate the value of the stock as a percentage of the total ASV and total TPV (per month - whether the month is selected or not). The total ASV and TPV will be summarised if there is more than one Customer slected (C1 or C2)

So for example in the attached file if I select Dec 2021 for Customers C1 and C2, I get the correct answers at the Customer Code level and the Code level.

However if I remove the selection of the date, I don’t get the right results. I have tried so many things with ALL, ALLEXCEPT, REMOVEFILTERS, FILTERS etc and I can’t seem to get it to work. I recognise my [Total ASV 2] variable is missing something but I don’t know what.
For Dec 21 for both C1 and C2, the [Total ASV 2] at the Customer Code and Code levels are correct, but as soon as I remove the Date filter, it goes haywire :frowning:

In a similar but different vein, the Total TPV figure is not working at all even though I have created it very similarly. The [Total TPV] figure for Dec 21 should be $237,820 at the Code level.

Please help I’m going slightly mad!!
Your assistance is greatly appreciated :slight_smile:
Thanks
Test 2 Monthly.pbix (65.6 KB)
Test Data 2.xlsx (16.8 KB)

OMG - I fixed it, through brute force I discovered I could use a combination of fields in ALLSELECTED to get the results at the correct level.

ALLSELECTED(Monthly[Classification],Monthly[Sub Classification],Monthly[Code])

What a relief.
Thanks to everyone who posts on bulletin boards - a combination of assistance from many people solved this one.

:smile:

Great your issue is resolved and Thanks for sharing the solution.

Thanks
Ankit J