Measure to count total rows that doesn't depend on row grouping
Suppose I have a CSV table such as this.
My goal is to calculate, for each MainUnit, the % of it's sub unit count considering all sub units. I am aware that I can create a measure such as below,
UnitCount = COUNTA(UnitSubUnit[SubUnit])
and then in the table set it as [ Show value as --> Percent of grand total ] and it will get me the desired percentage.
But that's not quite what I'm looking for. What I want is a 'TotalUnitCount' measure, which will retun 12 in this example for each row in my table. The reason being I want to use the UnitCount and TotalUnitCount elsewhere in my project, including as parts of other measures. Essentially, this is what I'm looking for.
But it appears that if I calculate a measure like this, it will still not actually return the total number of rows, but rather still grouped acording to the row selection.
TotalUnitCount = COUNTROWS(UnitSubUnit)
When I attempted that, what I get is below; both UnitCount and TotalUnitCount return the same value.
I don't want to set a measure like 'TotalUnitCount = 12' hardcoded for two reasons.
The MainUnit and SubUnit count can change over time.
I want to be able to have a Page Level filter to filter MainUnit, and it should reflect the calculation accordingly. For example, if I chose my page level filter to select only A and C, then my desired output should be like this:
Is this a possibility without hardcoding a measure?