Forum Discussion

md8422's avatar
md8422
Frequent Visitor
4 years ago
Solved

M query add new rows based on a condition

Hi All,   I've been hitting a wall for the last few days on this problem, maybe somebody here has an idea on how to solve it.   I have 2 tables: Records and Requirements. The Records contains wh...
  • BA_Pete's avatar
    4 years ago

    Hi md8422 ,

     

    Start with the Requirements table and crossjoin a distinct list of [object_id] by adding a custom column something like this:

    Table.Distinct(
        Table.SelectColumns(
            Records,
            {"object_id"}
        )
    )

     

    Then merge this with your Records table on Requirements[attribute], [object_id] = Records[attribute], [object_id].

    Expand your merge column to add the [Value] field.

     

    Pete