Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
peterhui50
Helper III
Helper III

Filtering two different tables with OR

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

 

peterhui50_0-1678212578800.jpeg

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

 

TableB

peterhui50_1-1678212625801.jpeg

 

TableC

peterhui50_2-1678212650937.jpeg

 

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

 

peterhui50_4-1678212964145.png

 

 

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

 

 

 

 

 

 

1 ACCEPTED SOLUTION
peterhui50
Helper III
Helper III

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

View solution in original post

1 REPLY 1
peterhui50
Helper III
Helper III

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors