Forum Discussion

imadelmouden's avatar
imadelmouden
Frequent Visitor
8 years ago
Solved

Count rows by filtering from two tables

I want to count rows from a tableB by feltering from tableA too, in fact the tables has a commun clomuns, PHONE and WEEK. I want to count rows that have the same PHONE and WEEK, here is the sql scri...
  • v-yulgu-msft's avatar
    7 years ago

    Hi imadelmouden,

     

    Please add below measure into a card visual.

    Measure=
    VAR temptable =
        FILTER (
            CROSSJOIN (
                TableA,
                SELECTCOLUMNS ( TableB, "Week2", TableB[Week], "Phone2", TableB[Phone] )
            ),
            [Week] = [Week2]
                && [Phone] = [Phone2]
        )
    RETURN
        COUNTX ( temptable, [Phone2] )

    Best regards,

    Yuliana Gu