nerdexam
Microsoft

70-466 · Question #36

You are developing a SQL Server PowerPivot workbook that sources data from a SQL Azure database. The PowerPivot model includes a single table named FactSales that consists of four columns named Year,

The correct answer is B. =Sales] / [ALLSELECTED(FactSales)]. The Sales % measure must use ALLSELECTED so the denominator reflects only the rows visible under current external filters (slicers), making the Grand Total equal 100% within the visible data set.

Build a tabular data model

Question

You are developing a SQL Server PowerPivot workbook that sources data from a SQL Azure database. The PowerPivot model includes a single table named FactSales that consists of four columns named Year, Country, Product, and Revenue. The model includes the following two measures. Sales:=SUM(FactSales[Revenue]); Sales %:=Sales] / CALCULATE([Sales], ALL(FactSales)) In Microsoft Excel 2010 you create the following PivotTable report. Users report that the Sales % measure computes an incorrect ratio. The measure should meet a requirement to compute a ratio over all visible sales values defined by the query filters. The Grand Total value for the Sales % measure should equal 100%. You need to fix the Sales % measure to meet the requirement. Which Data Analysis Expressions (DAX) expression should you use?

Exhibit

70-466 question #36 exhibit

Options

  • A=Sales] / CALCULATE([Sales])
  • B=Sales] / [ALLSELECTED(FactSales)]
  • C=Sales] / CALCULATE([Sales], VALUES(FactSales[Year]), VALUES(FactSales[Country]))
  • D=Sales] / [SALES] / CALCULATE([Sales], ALLLEXCEPT(FactSales, FactSales[Year]))

How the community answered

(23 responses)
  • A
    17% (4)
  • B
    70% (16)
  • C
    9% (2)
  • D
    4% (1)

Why each option

The Sales % measure must use ALLSELECTED so the denominator reflects only the rows visible under current external filters (slicers), making the Grand Total equal 100% within the visible data set.

A=Sales] / CALCULATE([Sales])

CALCULATE([Sales]) with no filter arguments evaluates Sales in the current row context unchanged, so the expression reduces to [Sales]/[Sales] which always equals 1, not a meaningful percentage.

B=Sales] / [ALLSELECTED(FactSales)]Correct

ALLSELECTED(FactSales) removes the inner PivotTable row/column filters while preserving any external filter context such as slicer selections, so the denominator equals the total of all currently visible Sales values. This means each cell shows its proportion of the visible total, and the Grand Total row correctly sums to 100%. The original ALL(FactSales) ignored external filters entirely, causing the percentage to be computed against all data regardless of what was filtered.

C=Sales] / CALCULATE([Sales], VALUES(FactSales[Year]), VALUES(FactSales[Country]))

Supplying only VALUES(FactSales[Year]) and VALUES(FactSales[Country]) ignores the Product column filter, producing an incomplete denominator that does not generalize across all PivotTable filter combinations.

D=Sales] / [SALES] / CALCULATE([Sales], ALLLEXCEPT(FactSales, FactSales[Year]))

ALLEXCEPT(FactSales, FactSales[Year]) preserves Year filters in the denominator, so the ratio is computed within each Year rather than across all visible rows, and the Grand Total will not equal 100%.

Concept tested: DAX ALLSELECTED for percentage-of-visible-total calculations

Source: https://learn.microsoft.com/en-us/dax/allselected-function-dax

Topics

#DAX#ALLSELECTED#CALCULATE#filter context

Community Discussion

No community discussion yet for this question.

Full 70-466 Practice