Forum Discussion
Gozde
Helper I
8 years agoAdd rows to table according to grouping in different table
Hi, I would like to add rows to one table ( or combine two tables) according to group number from another table. These are what I have: Table 1 Name Part A x1 B y1 B x1 ...
- 8 years ago
Zubair_Muhammad
Community Champion
8 years agoHi Gozde
Please try this calculated table
New Table =
VAR Mytable1 =
ADDCOLUMNS (
Table1,
"My Group", CALCULATE ( FIRSTNONBLANK ( Table2[Group], 1 ) )
)
VAR JoinTables =
GENERATE (
SELECTCOLUMNS ( mytable1, "Name", [Name], "My Group", [My Group] ),
FILTER ( Table2, Table2[Group] = [My Group] )
)
RETURN
SELECTCOLUMNS ( JoinTables, "Name", [Name], "Group", [Group], "Part", [Part] )- Zubair_Muhammad8 years ago
Community Champion
- Gozde8 years ago
Helper I
Thanks for quick response. It helped me alot.
It is working in the example code. But, not in my real big data, becauase I have some parts in Table 1 which are missing in Table 2 (not have the group). How can I keep these parts? What should I change in code?
Thank you :)
Gozde
- Zubair_Muhammad8 years ago
Community Champion