Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

count value with value from another table

I have 2 tables, table 1 has an ID column which has relationship (1-to-1) with table 2, where all ID's are stored from all kinds of other tables (not only table 1). Table 2 has also a column with the value yes/no. I need the write a measure which counts the ID's from table 1 on how many yes or no are in table 2? Hope someone can help me out.

 

Table 1

ID

1

2

3

 

Table 2

ID     yes/no

2         y

3         n

4         n

 

  • Anonymous 

    measure =
    CALCULATE (
        COUNT ( tbl2[id] ),
        FILTER ( VALUES ( tbl[yes/no] ), tbl[yes/no] = "y" )
    )
    
    

1 Reply

  • smpa01's avatar
    smpa01
    Community Champion

    Anonymous 

    measure =
    CALCULATE (
        COUNT ( tbl2[id] ),
        FILTER ( VALUES ( tbl[yes/no] ), tbl[yes/no] = "y" )
    )