Forum Discussion

sneem's avatar
sneem
Frequent Visitor
3 years ago
Solved

Measure using linked table

Hi !   I have a problem with my dax measure which doesn't seem to be complicated ... I have two tables : Match (with columns team_1_id and team_2_id) and Details (of the match) linked by match_id,...
  • sneem's avatar
    3 years ago

    I finally found the solution which was simple.

    I made the two relations inactive, and then I was able to access to the team_1_id and team_2_id like this:

    Win_Home =
    CALCULATE (
        COUNTROWS ( details ),
        FILTER (
            details,
            details[team_1_final_score] > details[team_2_final_score]
                &&  RELATED ( match[team_1_id] ) == [SelectedTeamId]
        )
    )
     
    and 
     
    Win_Away =
    CALCULATE (
        COUNTROWS ( details ),
        FILTER (
            details,
            details[team_2_final_score] > details[team_1_final_score]
                &&  RELATED ( match[team_2_id] ) == [SelectedTeamId]
        )
    )