Forum Discussion
mike_viz_lord
5 years agoFrequent Visitor
How to count rows from another table in Power Query
Table_A is a list of each STATE along with dimensions and measures for each state. Table_B is a list of ATTORNEY_NAME by STATE (one to many relationship). I'm trying to create a custom column in Tabl...
- Anonymous5 years ago
Sorry, that's wrong. THIS will work, and it's easier.
NewStep=Table.NestedJoin(PreviousStep, {"STATE"}, Table.Distinct(TABLE_2), {"STATE"}, "People", JoinKind.LeftOuter)
Now, instead of Expanding the table column, you can choose Aggregate, select "Count" for either column, and you are done,
Anonymous
5 years agoNot applicable
You could use:
NewColumn=Table.AddColumn(LastStep, "Rows", each Table.RowCount(Table.SelectRows(TableName, each [Table_B.STATE] = [Table_A.STATE])))
Anonymous
5 years agoNot applicable
Sorry, that's wrong. THIS will work, and it's easier.
NewStep=Table.NestedJoin(PreviousStep, {"STATE"}, Table.Distinct(TABLE_2), {"STATE"}, "People", JoinKind.LeftOuter)
Now, instead of Expanding the table column, you can choose Aggregate, select "Count" for either column, and you are done,