I need DAX to calculate Brand Total, which would return 1 number per Brand, as a total of distinct values, ignoring week & product filters.
Data sample:
Brand Product Week Weekly_sales
Brand_1 Prod_1 1 178
Brand_2 Prod_3 1 7
Brand_2 Prod_4 1 7
Brand_2 Prod_5 1 7
Brand_2 Prod_6 1 7
Brand_1 Prod_1 2 224
Brand_2 Prod_3 2 18
Brand_2 Prod_4 2 18
Brand_2 Prod_5 2 18
Brand_2 Prod_6 2 18
Brand_1 Prod_1 3 186
Brand_1 Prod_2 3 186
Brand_2 Prod_3 3 21
Brand_2 Prod_4 3 21
Brand_2 Prod_5 3 21
Brand_2 Prod_6 3 21
Brand_1 Prod_1 4 172
Brand_1 Prod_2 4 172
Brand_2 Prod_3 4 12
Brand_2 Prod_4 4 12
Brand_2 Prod_5 4 12
Brand_2 Prod_6 4 12
The desired output in power pivots is 1 number by brand for any week/product of that brand, inc sub/grand totals i.e. this is what pivot would look like:
I have tried countless combinations of FILTER, ALLEXCEPT, SUMX, and the closest I got to is this:
BRAND total:=
CALCULATE(
SUMX( ALLEXCEPT( DATA,
Data[Brand],
Data[Week]),
[Vol BR max]),
VALUES(Data[Brand])
)
where [Vol BR max] is a measure:
[Vol BR max]:= MAX(Data[Weekly_sales])
This returns 1 number per brand as I wanted, but it's a wrong total - not one of distinct values by brand: