- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
One to Many ... not so easy when using columns in a table from both tables
Assignments (1)
ID
Assigned To
The values being
Tom
Richard
Harry
Bob
Schedules (Many)
ID
Scheduled To
Jane
Beth
April
I've done this before (at least I think I have) and I can't remember how to accomplish this feat with the following result.
Assigned To, Scheduled To, Assigned, Scheduled
Name, Name, countrows(Assignments), countrows(Schedules)
When I do it, it repeats all of the ScheduledTo for each AssignedTo rows, so I get something like this (even if there are no rows in the second table).
Tom Jane
Tom Beth
Tom April
Richard Jane
Richard Beth
Richard April
Harry Jane
Harry Beth
Harry April
Bob Jane
Bob Beth
Bob April
When I reality I want
Tom Beth
Richard Jane
Richard April
Harry April
Bob blank (because Bob doesn't have related record in the ScheduledTo table)
I'm basically trying to count the rows of each table by the pair of people, but it's not working as I expect
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Your data has not been pasted properly. Please repaste the data properly.
Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Assigned To
ID Name
1 | Tom |
2 | Richard |
3 | Harry |
4 | Bob |
Scheduled To
IDName
1 | Beth |
2 | Jane |
2 | April |
3 | April |
Yields This Output
NameName2CountRowsAssignedCountrowsScheduled
Bob | April | 1 | |
Bob | Beth | 1 | |
Bob | Jane | 1 | |
Harry | April | 1 | 1 |
Harry | Beth | 1 | |
Harry | Jane | 1 | |
Richard | April | 1 | 1 |
Richard | Beth | 1 | |
Richard | Jane | 1 | 1 |
Tom | April | 1 | |
Tom | Beth | 1 | 1 |
Tom | Jane | 1 |
The blanks in the countrowsscheduled column ideally should not be there because there is no matching pair.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
U used this M code
let
Source = Table.NestedJoin(Table1,{"ID Name"},Table2,{"ID Name"},"Table2",JoinKind.LeftOuter),
#"Expanded Table2" = Table.ExpandTableColumn(Source, "Table2", {"Scheduled To"}, {"Scheduled To"})
in
#"Expanded Table2"
Here's the result i got
Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I was trying to do it in DAX... not through M.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Assume you have got the third table, thus I can make changes on the table.
Create calculated columns
Column = CONCATENATE(CONCATENATE([Name]," "),[Name2]) Column 2 = CALCULATE(COUNT(Table3[CountrowsScheduled]),ALLEXCEPT(Table3,Table3[Name])) Column 3 = IF([CountrowsScheduled]=1,[Column],IF([Column 2]=BLANK(),[Name]))
Best Regards
Maggie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I ended up doing this to get by for the time being... I was hoping to get by without having to have this extra table floating around in my model, but this gets me by until I find a better way.
Assignments = SELECTCOLUMNS(NATURALLEFTOUTERJOIN ( Assignments, Scheduled )
The columns I needed for the calculations
)
It works... but I'm trying to find a way to make the table not exist.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How do you create relationships between two tables? are they linked by ID? how does the ID match each other?
From your information, I can't reproduce your scenario.
Could you share me some data?
Best Regards
Maggie

Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
03-26-2024 07:45 AM | |||
12-03-2023 04:26 AM | |||
05-21-2024 02:18 AM | |||
08-09-2024 01:56 AM | |||
05-24-2024 05:26 AM |
User | Count |
---|---|
83 | |
78 | |
52 | |
37 | |
36 |
User | Count |
---|---|
104 | |
85 | |
47 | |
44 | |
43 |