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
Anonymous
Not applicable

Matching rows in two tables

Hi,

 

I have two tables 

 

Table 1 : 

 

Id        A      B     C   D

1

2

3

4

5

    

Table 2 

 

Id   type 

1      A

1      B

1      C

2      A

2      C 

3      C

3      A 

3      A

 

Now I want to enter data in table 1 where I want sum of 'type' for each Id from table 2. eg Id = 1  A = 1 

 

So basically query will match id from table 1 in table 2 and count all the type from table 2 for that id.  I need a dax query for it.

 

Please help! TIA

1 ACCEPTED SOLUTION

@Anonymous

 

With Query Editor you can simply transform your Table2 into Table1

 

1) Add a duplicate column for Type

 

6002.png

 

2) Now pivot the Type Column Using Type-Copy Column as VALUES

 

6004.png

 

3) Final Result

 

6003.png


Regards
Zubair

Please try my custom visuals

View solution in original post

2 REPLIES 2
Zubair_Muhammad
Community Champion
Community Champion

@Anonymous

 

if you have to use DAX,and the 2 tables are related on ID Column

 

then you can add calculated columns in Table1 like

 

A = Calculate(Count(Table2[Type]),Table2[Type]="A")

 

B = Calculate(Count(Table2[Type]),Table2[Type]="B")


Regards
Zubair

Please try my custom visuals

@Anonymous

 

With Query Editor you can simply transform your Table2 into Table1

 

1) Add a duplicate column for Type

 

6002.png

 

2) Now pivot the Type Column Using Type-Copy Column as VALUES

 

6004.png

 

3) Final Result

 

6003.png


Regards
Zubair

Please try my custom visuals

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.