March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi, I would like to know if someone could help me with the following question:
I need to filter only the columns with the most recent date (and smaller than today, if possible), filtering the maximum for each ID and keeping the information from the rest of the table for that row. I tried with group by, but it's a lot of data and it doesn't load, I tried to filter and delete duplicates, but I'm using directquery so it's not possible to delete data.
When using the filter when modifying the table, it returns this formula:
= Table.SelectRows(TABLE1, let latest = List.Max(TABLE1[Date]) in each [Date] = latest)
would it not be possible to edit it and mention that I would like it to return all rows, selecting only the most recent/maximum of each ID?
Example
Should result in this:
Thanks!
Hi,
This M code works
let
Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"Date", type date}, {"Address", type text}}),
#"Filtered Rows" = Table.SelectRows(#"Changed Type", each [Date] < DateTime.Date(DateTime.LocalNow())),
#"Grouped Rows" = Table.Group(#"Filtered Rows", {"ID"}, {{"Count", each Table.Max(_,"Date")}}),
#"Expanded Count" = Table.ExpandRecordColumn(#"Grouped Rows", "Count", {"Date", "Address"}, {"Date", "Address"})
in
#"Expanded Count"
Hope this helps.
I replaced all the field names with the real ones in the table correctly, the problem is that after the "IN" if I put only #"Expanded Count" it does not work, I believe it needs to mention the table too
After in, you always have to specify the name of the last step.
Unfortunately, it does not work because it has a group function and this is not supported with DirectQuery.
@Jug , refer my blog for the same
https://amitchandak.medium.com/power-bi-get-the-last-latest-value-of-a-category-d0cf2fcf92d0
I was able to use this filter of the most recent date only in the dashboard, but I need to have information from different data tables in the same table.
For example, showing the most recent address from the address table and the customer name from the client table, they have already been related by the client code, but I need the filter so that the table does not bring all the registered addresses of the same client.
I would need to bring information from two tables and your formula includes only one. Would it be possible to include fields from another table?
Unfortunately I could not use these ideas, because I'm trying to do this filter in the modification of the query, so then I can create a relationship with another table, so create a measure does not help me in this, from what I saw, it does not appear as a column in the table. Thus, I can't use.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
87 | |
85 | |
70 | |
51 |
User | Count |
---|---|
205 | |
153 | |
97 | |
79 | |
69 |