Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowTry your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now
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.
Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.
Check out the May 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 4 | |
| 4 | |
| 2 | |
| 2 | |
| 1 |
| User | Count |
|---|---|
| 11 | |
| 10 | |
| 5 | |
| 4 | |
| 4 |