cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Joining two tables

I have two tables 

 

id   column b  column c 

1

2

3

4

5

 

 

TABLE 2 

 

Id   feature  column c

1       1

2       1

3       2

4       3

5       4 

 

 

Now I want count of id from table 1 where feature (from table 2) is not equal to 1.  id being common in both tables. So basically as in above case it shoud return count as "3". 

1 ACCEPTED SOLUTION
v-huizhn-msft
Microsoft
Microsoft

Hi @Anonymous,

First you should create relationship between Table1 and Table2. Please click Manage Ralationships->New Relationship, you can create it by the common columns in both tables as the screenshot shown.

3.png

Click OK, the relationship is built. Select the relationship button(highlighted in red line), you can there is a relationship between them.

1.PNG

Then, create a measure using the formula.

 

result = CALCULATE(COUNTA(Table1[id]),FILTER(Table2,Table2[feature]<>1))

Finnaly, create a card visual to display the measure, you will get the desired result.

2.PNG

If you have other issues, please let me know.

 

Best Regards,
Angelia

View solution in original post

1 REPLY 1
v-huizhn-msft
Microsoft
Microsoft

Hi @Anonymous,

First you should create relationship between Table1 and Table2. Please click Manage Ralationships->New Relationship, you can create it by the common columns in both tables as the screenshot shown.

3.png

Click OK, the relationship is built. Select the relationship button(highlighted in red line), you can there is a relationship between them.

1.PNG

Then, create a measure using the formula.

 

result = CALCULATE(COUNTA(Table1[id]),FILTER(Table2,Table2[feature]<>1))

Finnaly, create a card visual to display the measure, you will get the desired result.

2.PNG

If you have other issues, please let me know.

 

Best Regards,
Angelia

Helpful resources

Announcements
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Top Solution Authors