Forum Discussion

peterhui50's avatar
peterhui50
Helper III
3 years ago
Solved

Filtering two different tables with OR

I am not sure what I am doing wrong, but there is the data model

 

and there are the data that's in Table B and Table C - they are identical

 

TableB

 

TableC

 

I basically want to do a countrows of TableA, but with two criterias, that is if TableB[Count] = 1 OR TableC[Count]=2

It should return 1 row, because either of these are true.

 

When I write - 

CALCULATE( [Row_CountA], FILTER(B,B[Count]=1) || FILTER(C,C[Count] = 2))

it gives me an error and says

 

 

 

Is there a way to easily fix this? Thank you! much thanks in advance

 

 

 

 

 

 

  • This worked

     

    Measure =

    VAR Table_Test = SUMMARIZECOLUMNS(A[NAME], "B_Totals", SUM(B[Count]), "C_Totals", SUM(C[Count]))
    RETURN
    CALCULATE( [Row_CountA], FILTER(Table_Test, [B_Totals] = 1 || [C_Totals] = 2))
     
    returned the value of 2 because there are two rows in table A, that matches the criteria of Table B totals = 1 OR Table C totals = 2

1 Reply

  • This worked

     

    Measure =

    VAR Table_Test = SUMMARIZECOLUMNS(A[NAME], "B_Totals", SUM(B[Count]), "C_Totals", SUM(C[Count]))
    RETURN
    CALCULATE( [Row_CountA], FILTER(Table_Test, [B_Totals] = 1 || [C_Totals] = 2))
     
    returned the value of 2 because there are two rows in table A, that matches the criteria of Table B totals = 1 OR Table C totals = 2