DP-500 · Question #143
You need to create a DAX measure that will return the percent of total sales for each product. The measure must respect the report-level filter when calculating the total. How should you complete…
These two questions test knowledge of DAX filter context manipulation for percent-of-total calculations in Power BI, and the correct mapping of SQL query result columns to chart axes in Azure Synapse Studio.
Question
Explanation
These two questions test knowledge of DAX filter context manipulation for percent-of-total calculations in Power BI, and the correct mapping of SQL query result columns to chart axes in Azure Synapse Studio.
Approach. For the DAX measure, the correct pattern is DIVIDE(SUM(Sales[Amount]), CALCULATE(SUM(Sales[Amount]), ALLSELECTED())). ALLSELECTED() is critical here - unlike ALL() which strips every filter including slicers and report-level filters, ALLSELECTED() removes only the row/visual context filters while preserving any filters applied at the report level (e.g., page filters, slicer selections). CALCULATE() is required to override the current filter context so the denominator computes total sales across all products, not just the current row's product. DIVIDE() is used instead of the '/' operator to safely handle division-by-zero without errors. For the column chart in Synapse Studio, the SQL query produces two columns - OrderYear (the time dimension) and GrossRevenue (the aggregated metric). OrderYear maps to the X-axis (Axis/Category setting) because it represents the time progression, while GrossRevenue maps to the Y-axis (Values setting) because it is the quantity being measured over time - this correctly visualizes how gross revenue changes year over year.
Concept tested. DAX filter context and ALLSELECTED() vs ALL() for percent-of-total measures respecting report-level filters; mapping SQL result set columns (dimension vs. measure) to the correct chart axis settings in Azure Synapse Studio.
Reference. Microsoft Learn: DAX ALLSELECTED function - https://learn.microsoft.com/en-us/dax/allselected-function-dax; Azure Synapse Analytics - Visualize data with Synapse Studio charts
Topics
Community Discussion
No community discussion yet for this question.