Forum Discussion

dbollini's avatar
dbollini
Icon for Helper II rankHelper II
1 year ago
Solved

Join Two Tables and Get the values

Hello All,          SELECT @TotalTeamMemberCount = Count(DISTINCT tm.EmpId)        FROM IPME_TeamMembers tm        INNER JOIN IPME_Teams t on tm.TeamID = t.ID        INNER JOIN RideOutEvents roe...
  • sevenhills's avatar
    1 year ago

    Are these three tables have relationships? i.e., from Teams to team members to ride out events, do they have relationships in place?

     

    Then try this. (Try first without ALL and try with ALL - one should work. )

     

     

     

    TotalTeamMemberCount = 
    Calculate( 
     DISTINCTCOUNT( IPME_TeamMembers[EmpId]), 
     FILTER ( ALL('RideOutEvents'), RideOutEvents [RideOutEventID ] = @EventId ),
                         -- Replace with your variable or value
     FILTER ( ALL('IPME_Teams'), IPME_Teams [SectionId] IN { 0, @SectionId)) 
                         -- Replace with your variable or value 
    )