Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Counting a column based on a filter from another column

Hi Community,   I have two tables. Table A: Student # Sibling # 1 S1 1 S2 2 S1 3 S1 3 S2 3 S3 TABLE B: Student# Sibling# Status 1 S2 InActive 2...
  • rajendraongole1's avatar
    2 years ago

    Hi Anonymous -Create a measure to find the distinct students as below:

    DistinctActiveStudents =
    CALCULATE(
    DISTINCTCOUNT('TableA'[Student #]),
    FILTER(
    'TableA',
    COUNTROWS(
    FILTER(
    'TableB',
    'TableA'[Student #] = 'TableB'[Student#] &&
    'TableA'[Sibling #] = 'TableB'[Sibling#] &&
    'TableB'[Status] = "Active"
    )
    ) > 0
    )
    )

     

    Replace TableA and TableB as per your model and add the above measure to your visual.

    Hope it works.

     

    Did I answer your question? Mark my post as a solution! This will help others on the forum!
    Appreciate your Kudos!!