Forum Discussion

Rbie's avatar
Rbie
Frequent Visitor
3 years ago
Solved

a count based on columns from different tables

Something trivial but I can't figure it out.

I have 3 related tables

Table1 - ID, Bool1, 

Table2 - Table1ID, SubID, Bool2 

Table3 - Table2SubID, Bool3

Table1 OnetoMany Table2 OnetoMany Table3

 

I need to count the records where Bool1 = true and Bool2 = true and Bool3=true

  • Hi Rbie ,

     

    Try the following code:

    COUNT TRUE VALUES=
    COUNTROWS (
        FILTER (
            SUMMARIZE (
                Table3,
                Table3[TableSubid],
                Table3[Bool3],
                Table2[Bool2],
                Table1[Bool1]
            ),
            Table3[Bool3] = TRUE ()
                && Table2[Bool2] = TRUE ()
                && Table1[Bool1] = TRUE ()
        )
    )

     

    Be aware that this may need some adjustments

1 Reply

  • Hi Rbie ,

     

    Try the following code:

    COUNT TRUE VALUES=
    COUNTROWS (
        FILTER (
            SUMMARIZE (
                Table3,
                Table3[TableSubid],
                Table3[Bool3],
                Table2[Bool2],
                Table1[Bool1]
            ),
            Table3[Bool3] = TRUE ()
                && Table2[Bool2] = TRUE ()
                && Table1[Bool1] = TRUE ()
        )
    )

     

    Be aware that this may need some adjustments