This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowJuly 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more
From the File combine custom function, you can filter a Record attribute using the following syntax:
each [RecordColumnName]?[AttributeColumnName]?
Below I have a dataset where I grouped the data according to Source.Name, intending only to get the row with the most recent timestamp via the Index column. Is there a way I can filter the Custom table without needing to expand it and applying a filter step afterwards?
Solved! Go to Solution.
Hi,
Yes, you can filter the nested table without expanding it, and in most cases this is preferable because it keeps the transformation within each grouped table.
For example, if you only want the row with the highest Index from each nested table, you can use:
Table.TransformColumns(
#"Grouped rows",
{
"Custom",
each Table.Max(_, "Index")
}
)
or equivalently:
Table.TransformColumns(
#"Grouped rows",
{
"Custom",
each
let
maxIndex = List.Max(_[Index])
in
Table.SelectRows(_, each [Index] = maxIndex)
}
)
Which is more efficient?
Table.Max() is generally the better choice because:
That said, the actual performance difference is usually small unless you're working with very large nested tables.
Can this be done without nested tables?
Yes. If your goal is simply to keep the latest record per Source.Name, another common approach is:
This avoids creating grouped/nested tables altogether and is often faster, especially if query folding is preserved.
For example:
let
Sorted =
Table.Sort(
Source,
{
{"Source.Name", Order.Ascending},
{"Date created", Order.Descending}
}
),
Latest =
Table.Distinct(Sorted, {"Source.Name"})
in
Latest
Regarding Table.Buffer(), I'd recommend using it only after profiling your query. While it can improve performance in some scenarios by preventing repeated evaluation, it also breaks query folding and loads the buffered table into memory, which can actually degrade performance for large datasets.
If your source supports query folding (e.g., SQL Server, Fabric, Dataverse), the Sort + Distinct approach is often the most efficient. If query folding isn't available, Table.Max() within the grouped tables is a clean and efficient solution.
Hope this helps.
Thanks!
Hi @olimilo
We wanted to follow up to check if you’ve had an opportunity to review the previous responses. If you require further assistance, please don’t hesitate to let us know.
Hi @olimilo
Following up to confirm if the earlier responses addressed your query. If not, please share your questions and we’ll assist further.
Hi,
Yes, you can filter the nested table without expanding it, and in most cases this is preferable because it keeps the transformation within each grouped table.
For example, if you only want the row with the highest Index from each nested table, you can use:
Table.TransformColumns(
#"Grouped rows",
{
"Custom",
each Table.Max(_, "Index")
}
)
or equivalently:
Table.TransformColumns(
#"Grouped rows",
{
"Custom",
each
let
maxIndex = List.Max(_[Index])
in
Table.SelectRows(_, each [Index] = maxIndex)
}
)
Which is more efficient?
Table.Max() is generally the better choice because:
That said, the actual performance difference is usually small unless you're working with very large nested tables.
Can this be done without nested tables?
Yes. If your goal is simply to keep the latest record per Source.Name, another common approach is:
This avoids creating grouped/nested tables altogether and is often faster, especially if query folding is preserved.
For example:
let
Sorted =
Table.Sort(
Source,
{
{"Source.Name", Order.Ascending},
{"Date created", Order.Descending}
}
),
Latest =
Table.Distinct(Sorted, {"Source.Name"})
in
Latest
Regarding Table.Buffer(), I'd recommend using it only after profiling your query. While it can improve performance in some scenarios by preventing repeated evaluation, it also breaks query folding and loads the buffered table into memory, which can actually degrade performance for large datasets.
If your source supports query folding (e.g., SQL Server, Fabric, Dataverse), the Sort + Distinct approach is often the most efficient. If query folding isn't available, Table.Max() within the grouped tables is a clean and efficient solution.
Hope this helps.
Thanks!
Filters each nested Custom table to return only the row with the highest Index value (latest record)
Table.SelectRows([Custom], each [Index] = List.Max([Custom][Index]))
Try this custom column
Table.SelectRows([Custom], each [Index] = List.Max([Custom][Index]))
Hello @olimilo
If this response was helpful in any way, I’d gladly accept a kudo.
Please mark it as the correct solution. It helps other community members find their way faster.
Connect with me on LinkedIn
I understand the syntax is simpler, but would it necessarily equate to being more efficient performance-wise
Table.TransformColumns( #"Grouped rows", { "Custom", each Table.Max(_, "Index") } )
compared to this one?
Table.TransformColumns( #"Grouped rows", { "Custom", each let maxIndex = List.Max(_[Index]) in Table.SelectRows(_, each [Index] = maxIndex) } )
Furthermore, is there a way to do this without needing to create a nested table? I saw another example that only requires the need to Buffer, Sort and Remove Duplicates but I am unsure as to how efficient the Buffer step would be, as opposed to grouping by ID, adding a group/row index then filtering for the Max/Min Index.
Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.
If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!
Check out the July 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 25 | |
| 23 | |
| 20 | |
| 18 | |
| 14 |
| User | Count |
|---|---|
| 24 | |
| 20 | |
| 20 | |
| 19 | |
| 19 |