M6 · Modeling · about 20 min
Both Directions Is Not a Fix
mediumThe player page needs games played per player. COUNTROWS( Games ) shows 600 for every player. A forum answer says to set the Batting to Games relationship to Both, which makes the numbers right, and quietly changes how every Games filter behaves in the rest of the report.
Your task
Create a measure named [Games Played]: the number of games in which a player has a batting line, in the current filter. It must respond to Player, Team and Season filters and stay blank for a player with no batting lines. Keep every relationship single direction.
What the grader checks
You see the situations, not the expected numbers. The expected values are computed live from your file and the source data.
- T1One team's players
Players filtered to one team's roster, one row per player, all seasons. - T2Same players, Season 2024
The same roster with the Season slicer set to 2024. - T3By team
One row per team: each team's games with at least one batting line. - T4Whole league, by player
Every player, all seasons. - C1No bidirectional filters
Every relationship in the model filters in one direction only.
Stuck?
Open one hint at a time.
Hint 1
Draw the arrows: Players filters Batting. Does Batting filter Games, or is it the other way round?
Hint 2
You don't need Games to be filtered by the player. Batting already holds a GameID on every batting line, and a player's lines are already filtered.
Hint 3 (near-answer)
DISTINCTCOUNT( Batting[GameID] ). If you really need the Games table, use CROSSFILTER( Batting[GameID], Games[GameID], Both ) inside CALCULATE, not on the relationship.
Show the editorial
Solve it first if you can: the editorial gives the answer away.
The trap
Filters flow from the one side to the many side: Players filters Batting, and Games filters Batting. Nothing flows from Batting back to Games, so COUNTROWS( Games ) ignores the player and shows all 600 games. Setting the relationship to Both makes it work, but it changes the model for every measure: a player slicer now filters Games too, which changes game counts, averages per game and anything else built on Games, and it can make other filter paths ambiguous.
The fix
DISTINCTCOUNT( Batting[GameID] ).
Why it works
The games a player appeared in are already visible in Batting: each batting line carries its GameID, and the player filter already reaches Batting. Counting distinct GameIDs there answers the question without moving any filter against the relationship. Counting Batting rows is close but not the same: it counts batting lines, so a team shows lines, not games. When you do need a filter to flow both ways, CROSSFILTER inside CALCULATE does it for that one measure.
Count where the filter already reaches. Bidirectional filtering belongs in a measure (CROSSFILTER), not on the relationship.