This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
Hello!
I need help finding a solution. I have a table containing a list of employees named "Employee List" with two columns: "month" and "name."
I need to determine, for each month:
I initially separated them into two different tables and then merged them. However, this approach is not the most straightforward to update. I want to keep everything in one table to retain historical data.
Thanks fo anyone will read this! 😊
Valeria
Hello, @Anonymous group data by month to get a table with 2 columns: month and list of employees. Then create a list of rows with (Table.ToRecords or Table.ToRows - upon your liking). Then run List.Generate to calculate what you want using List.Difference(current, previous) to get those who joined and List.Difference(current, next) to get those who left.
Hello @AlienSx, thanks for responding.
I think I don't need to group. Below example of the data.
can you explain better how I use table.toRecord/ToRows and List. Generate? I am quite new to PowerBi.
Thanks a lot
Valeria
Hello, @Anonymous you did not show the result you expected to see in the end so I created columns with ee names as lists (joined and left).
let
Source = your_table,
g = Table.Group(Source, "Month", {{"e", each _[Name]}}),
rows = List.Buffer(Table.ToRecords(g)),
gen = List.Generate(
() =>
[i = 0,
r = rows{0} &
[joined = {},
n_joined = 0,
left = List.Difference(rows{0}[e], try rows{1}[e] otherwise {}),
n_left = List.Count(left)]],
(x) => rows{x[i]}? <> null,
(x) =>
[i = x[i] + 1,
r = rows{i} &
[joined = List.Difference(rows{i}[e], rows{i - 1}[e]),
n_joined = List.Count(joined),
left = try List.Difference(rows{i}[e], rows{i + 1}[e]) otherwise {},
n_left = List.Count(left)]],
(x) => x[r]
),
z = Table.FromRecords(gen)
in
z
Assuming the following definitions:
The following approach would not account for leaves and rejoins, i.e. only the earliest join and the latest leave per employee is listed:
Do you need to consider leaves and rejoins?
Hello Martin, I don't have any dates in my table, just name and month. I need to know the list of names left and the ones joined.
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.