You can calculate the percentage contribution dynamically using CALCULATE(), ALL(), or ALLSELECTED() to control filter context.
1. Create the Percentage Contribution Measure
% Contribution =
VAR TotalSales = CALCULATE([Total Sales], ALLSELECTED('Sales'))
RETURN
DIVIDE([Total Sales], TotalSales, 0)
2. Explanation
ALL SELECTED ('Sales') checks that total consider active slicer filters while filtering out row-level filters (filtering by column, for example).
DIVIDE() avoids the division by zero problems.
3. How It Works
In this case, if the user applies a filter by Region, the percentage will be evaluated for only those selected regions.
When no filter is applied, it shows the overall contribution of each category in sales.