Forum Discussion

Nicole_H's avatar
Nicole_H
Frequent Visitor
1 year ago
Solved

Repeat row answers in a new column

Hi all,   I have a table of info on users, projects and their status.  I need a sort of master column that returns 'Closed' for every user ID if any of their projects are closed.  I have done it be...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi Nicole_H,

    Thanks for reaching out to the Microsoft fabric community forum.

    You can achieve this in Power Query using grouping and merging logic. Here's a simple approach that should give you the desired result first load your table into Power Query then group the data by User ID and create a new column that checks if any of the statuses for that user are "Closed":

    let
    Source = YourTableName,
    Grouped = Table.Group(Source, {"User ID"}, {
    {"AnyClosed", each List.ContainsAny([Status], {"Closed"}), type logical}
    })
    in
    Grouped

    Now merge this grouped table back with your original table using User ID as the key and add a custom column to return "Closed" if AnyClosed is true, otherwise leave it blank (if [AnyClosed] then "Closed" else null). Remove helper columns if needed and rename your new column to Master Status or whatever suits your needs.

    This method avoids manual steps and ensures that the "Closed" status is consistently applied across all rows for each user.

     

    If I misunderstand your needs or you still have problems on it, please feel free to let us know.  

    Best Regards,
    Hammad.