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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
Guenfood77
Frequent Visitor

Count common values from another table

Hi,

 

I've got 2 tables with same field "Id_User"

I'd like to count number of values in my Table2 which are in my Table1

With the example behind, the measure must display : 3 Id 1501, 2 Id 1502, 2 Id 1503 and 1 Id 1504

Thanks for your help.

 

Id_User Table 1Id_User Table 2
15011501
15021501
15031501
15041502
 1502
 1503
 1503
 1504
1 ACCEPTED SOLUTION
3CloudThomas
Super User
Super User

Create a relationship between the 2 tables in the model view.

Use the UserId column Table 1 is the one side, and Table2 is the many side.

Create a count measure in table2 - UserCount = COUNT( 'Table2'[UserId])

Please measure and UserId in a table visual or bar chart

View solution in original post

2 REPLIES 2
3CloudThomas
Super User
Super User

Create a relationship between the 2 tables in the model view.

Use the UserId column Table 1 is the one side, and Table2 is the many side.

Create a count measure in table2 - UserCount = COUNT( 'Table2'[UserId])

Please measure and UserId in a table visual or bar chart

Thanks for your answer.

It seems ok but i've got a wrong result.

I forgot to apply a condition.

The count must integrate that value of field "Option" must be "1" in my Table1.

I tried to apply a filter in the formula but it doesn't match.

 

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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