Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello,
I have a problem in Power BI
I use Power BI (not Query) and in table, i want to return only rows by the min date of the key.
For example
A 2/01 Blue
A 3/01 Red
A 5/01 Blue
B 3/02 Blue
B 5/04 Red
I want : A 2/01 Blue
B 3/02 Blue
I tried to use SUMMARIZE but it only returns the key and the min date, and note the other columns like the color in my example.
How can i return the entire row that contains the min date per key ?
@nr63bi Maybe:
Table =
VAR __Table = SUMMARIZE('Table', [ID], "__Date", MIN('Table'[Date]))
VAR __IDs = SELECTCOLUMNS(__Table, "__ID", [ID])
VAR __Dates = SELECTCOLUMNS(__Table, "__Date", [__Date])
VAR __Result = FILTER('Table', [ID] IN __IDs && [Date] IN __Dates)
RETURN
__Result
@Greg_Deckler hey thank you i like the idea but it don't work
it returns me 100 000 rows and i expect 19 521
(the distinct)
@nr63bi Try this:
Table =
VAR __Table = SUMMARIZE('Table', [ID], "__Date", MIN('Table'[Date]))
VAR __IDs = SELECTCOLUMNS(__Table, "__ID", [ID])
VAR __Dates = SELECTCOLUMNS(__Table, "__Date", [__Date])
VAR __Result = DISTINCT(FILTER('Table', [ID] IN __IDs && [Date] IN __Dates))
RETURN
__Result
I try another solution inspired by your answer
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
97 | |
97 | |
81 | |
77 | |
66 |
User | Count |
---|---|
126 | |
105 | |
103 | |
81 | |
72 |