Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live 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, @Valeria 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, @Valeria 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.
The Power BI Data Visualization World Championships is back! It's time to submit your entry.
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 18 | |
| 13 | |
| 9 | |
| 8 | |
| 8 |