Complete the code to create a pie chart showing sales by category.
PieChart = SUMMARIZE(Sales, Sales[Category], "TotalSales", SUM(Sales[[1]]))
The pie chart needs the sales amount to sum by category. Using SUM(Sales[Amount]) calculates total sales correctly.
Complete the DAX measure to calculate the percentage share for each category in the pie chart.
CategoryShare = DIVIDE(SUM(Sales[Amount]), CALCULATE(SUM(Sales[Amount]), ALL(Sales[[1]])))The ALL(Sales[Category]) removes filters on category to get total sales for percentage calculation.
Fix the error in the DAX measure to show donut chart values correctly.
DonutValue = IF(ISBLANK(SUM(Sales[Amount])), [1], SUM(Sales[Amount]))Replacing blank sums with 0 ensures the donut chart shows zero instead of blank slices.
Fill both blanks to create a measure that calculates the total sales excluding the selected category for the donut chart center.
TotalOther = CALCULATE(SUM(Sales[Amount]), [1](Sales[Category]), Sales[Category] [2] SELECTEDVALUE(Sales[Category]))
Using FILTER with <> excludes the selected category from the total.
Fill all three blanks to create a measure that calculates the percentage of total sales for the selected category in a donut chart.
SelectedCategoryPercent = DIVIDE(SUM(Sales[[1]]), CALCULATE(SUM(Sales[[2]]), ALL(Sales[[3]])), 0) * 100
The numerator sums sales amount. The denominator sums sales amount ignoring category filter using ALL on Category. Multiplying by 100 converts to percentage.