PL-300 · Question #374
You have a Power BI model that contains two tables named Population and Date. The Population table contains two columns named PopulationAmount and DateKey. DateKey contains date values that represent
The correct answer is D. one row per year that contains the same value repeated for each year. A DAX measure using CALCULATE with an explicit filter for a specific year will override the visual's natural year filter context, causing that specific year's value to repeat for all years shown.
Question
You have a Power BI model that contains two tables named Population and Date. The Population table contains two columns named PopulationAmount and DateKey. DateKey contains date values that represent the first day of a year and are used to create a many-to-one relationship with the Date table. The Power BI model contains two measures that have the following definitions. Total Population = Sum(‘Population’[PopulationAmount]) 2023 Population = CALCULATE([Total Population], ‘Date'[Year] = 2023) You create a table visual that displays Date[Year] and [2023 Population]. What will the table visual show?
Options
- Aone row per year that contains blank values for every year except 2023
- Bone row per date that contains the population value for the corresponding year repeated in each
- Ca single row for the year 2023 that contains the related population value
- Done row per year that contains the same value repeated for each year
How the community answered
(39 responses)- A8% (3)
- B15% (6)
- C3% (1)
- D74% (29)
Why each option
A DAX measure using CALCULATE with an explicit filter for a specific year will override the visual's natural year filter context, causing that specific year's value to repeat for all years shown.
The `CALCULATE` function with an explicit filter overrides the external filter context, it does not allow other years to show blank values unless combined with other logic.
The table visual displays one row per distinct year in `Date[Year]`, not one row per date.
A single row for 2023 would only be shown if the visual itself was filtered to 2023, but here, `Date[Year]` is an axis displaying multiple years.
The `CALCULATE` function in `2023 Population` explicitly sets the filter context to `'Date'[Year] = 2023`, overriding any `Date[Year]` filter coming from the visual's row context. Therefore, for every year displayed in the `Date[Year]` column of the table visual, the `[2023 Population]` measure will always return the total population for 2023.
Concept tested: DAX CALCULATE function and filter context
Source: https://learn.microsoft.com/en-us/dax/calculate-function-dax
Community Discussion
No community discussion yet for this question.