
Answer-first summary for fast verification
Answer: SUMMARIZE(Sales, Sales[CategoryID], "Total Sales", SUM(Sales[SalesAmount]))
The correct DAX expression to calculate the total sales for each product category is to use the SUMMARIZE function, which groups the data by the 'CategoryID' column and calculates the sum of the 'SalesAmount' column, naming the result 'Total Sales' for clarity. Option A uses the SUMX function, which iterates over each row and sums the 'SalesAmount', but does not group by category, making it inefficient for this scenario. Option C incorrectly uses CALCULATE with an unnecessary ALL function and an incorrect GROUPBY clause, which does not serve the purpose of grouping by category. Option D simply calculates the total sales across all categories without any grouping, failing to meet the report's requirements.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
As a Microsoft Fabric Analytics Engineer Associate, you are tasked with optimizing a sales report for a retail company. The report needs to display the total sales for each product category, leveraging a data model that includes a 'Sales' table with columns 'ProductID', 'CategoryID', and 'SalesAmount'. The solution must efficiently handle large datasets and provide accurate results. Considering the requirements for performance and accuracy, which of the following DAX expressions would you use to correctly calculate the total sales for each product category? (Choose one correct option)
A
SUMX(Sales, Sales[SalesAmount])
B
SUMMARIZE(Sales, Sales[CategoryID], "Total Sales", SUM(Sales[SalesAmount]))
C
CALCULATE(SUM(Sales[SalesAmount]), ALL(Sales), GROUPBY(Sales[CategoryID], Sales[CategoryID]))
D
SUM(Sales[SalesAmount])
No comments yet.