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
dabutchart
Frequent Visitor

Summerizing data over 2 tables

I have 2 tables. Table1 has a column StaffNum.

 

Table2 has columns CourseTitle & StaffNum

 

Is it possible to create a table where column 1 is all the StaffNums from Table1 and column 2 contains all the courses relating to that StaffNum. For example, the output could be

 

StaffNumCourseTitle
123Course1
123Course2
123Course3
123Course4
234Course1
345Course2
345Course4
1 ACCEPTED SOLUTION
v-henryk-mstf
Community Support
Community Support

Hi @dabutchart ,

 

Create the following data model, then refer to the corresponding fields in the table visual and filter the rows that are not empty in the fiter.

vhenrykmstf_0-1657095639851.png

vhenrykmstf_1-1657095654807.png

If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


Best Regards,
Henry


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
v-henryk-mstf
Community Support
Community Support

Hi @dabutchart ,

 

Create the following data model, then refer to the corresponding fields in the table visual and filter the rows that are not empty in the fiter.

vhenrykmstf_0-1657095639851.png

vhenrykmstf_1-1657095654807.png

If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


Best Regards,
Henry


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

@dabutchart , isn't the table you want (with columns StaffNum and CourseTitle) the same as Table2 that you mention you have (which has columns CourseTitle and StaffNum)?

How is the table you want different to Table2?

The difference would be that the output table would contain all StaffNums from Table1 and the CourseTitles from Table2. 

Anonymous
Not applicable

@dabutchart , sorry but I cannot see the difference. Could you please post an example showing Table1, Table2, and the desired output table?

Table1

StaffNum
123
234
345

 

Table2

789Course1
123Course1
123Course2
123Course3
123Course4
234Course1
345Course2
345Course4

 

Output

123Course1
123Course2
123Course3
123Course4
234Course1
345Course2
345Course4
Anonymous
Not applicable

@dabutchart , ok so your output should be Table2 excluding any rows where the StaffID does not exist in Table1.

 

An alternative solution would be to create a calculated table using this DAX expression:

output = 
    CALCULATETABLE(
        'Table2',
        INTERSECT(
            VALUES('Table1'[StaffNum]),
            VALUES('Table2'[StaffNum])
        )
    )

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.