Complete the code to create a basic treemap visual in Power BI using the 'Category' field for grouping.
Treemap = SUMMARIZE(Sales, Sales[[1]], "TotalSales", SUM(Sales[Amount]))
In a treemap, you group data by a category to show parts of a whole. Here, 'Category' is the correct field to group by.
Complete the DAX measure to calculate total sales for the treemap visualization.
Total Sales = CALCULATE(SUM(Sales[[1]]))The 'Amount' column holds the sales value, so summing it gives total sales.
Fix the error in the DAX formula to calculate the percentage of total sales for each category in the treemap.
Sales % = DIVIDE(SUM(Sales[Amount]), CALCULATE(SUM(Sales[Amount]), ALL(Sales[[1]])))Using ALL(Sales[Category]) removes the filter on Category to get total sales for all categories, needed for percentage calculation.
Fill both blanks to create a treemap that shows total sales by category and colors by region.
TreemapVisual = SUMMARIZE(Sales, Sales[[1]], Sales[[2]], "TotalSales", SUM(Sales[Amount]))
The treemap groups by 'Category' and uses 'Region' for color coding to show sales distribution.
Fill all three blanks to write a DAX measure that calculates sales only for the selected category and region in the treemap.
Filtered Sales = CALCULATE(SUM(Sales[[1]]), FILTER(Sales, Sales[[2]] = SELECTEDVALUE(Sales[[2]]) && Sales[[3]] = SELECTEDVALUE(Sales[[3]])))
This measure sums 'Amount' but filters Sales where 'Category' equals the selected 'Category' value and 'Region' equals the selected 'Region' value, enabling dynamic filtering in the treemap.