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! Get ahead of the game and start preparing now! Learn more
Hello. Can you help me, please ?
I need a table with the same column, with unique (not duplicate) values from IDU column ... filtered by DATE column.
I need the first row (date) of each IDU.
Thanks a lot
| IDU | DATE | TRIM |
| 1 | 2/04/2021 | AAAA |
| 2 | 6/04/2021 | AAAA |
| 2 | 10/04/2021 | BBB |
| 2 | 14/04/2021 | BBB |
| 3 | 18/04/2021 | CCC |
| 4 | 22/04/2021 | CCC |
Solved! Go to Solution.
Here's the calculated table you want:
[New Table] = // This is a calculated table
// Let the table from your initial post
// be called T (you just substitute the
// name you've got in your model).
var IDUsWithFirstDates =
ADDCOLUMNS(
DISTINCT( T[IDU] ),
"@FirstDate",
CALCULATE(
MIN( T[Date] )
)
)
var Result =
CALCULATETABLE(
T,
TREATAS(
IDUsWithFirstDates,
T[IDU],
T[DATE]
)
)
RETURN
Result
Here's the calculated table you want:
[New Table] = // This is a calculated table
// Let the table from your initial post
// be called T (you just substitute the
// name you've got in your model).
var IDUsWithFirstDates =
ADDCOLUMNS(
DISTINCT( T[IDU] ),
"@FirstDate",
CALCULATE(
MIN( T[Date] )
)
)
var Result =
CALCULATETABLE(
T,
TREATAS(
IDUsWithFirstDates,
T[IDU],
T[DATE]
)
)
RETURN
Result
@astronauta49 , Create a new measure for TRIM and use min for date if needed
new TRIM =
VAR __id = MAX ('Table'[Name] )
VAR __date = CALCULATE ( MAX('Table'[Date] ), ALLSELECTED ('Table' ), 'Table'[Name] = __id )
CALCULATE ( max ('Table'[TRIM] ), VALUES ('Table'[Name] ),'Table'[Name] = __id,'Table'[Date] = __date )
thank you so much !!
Sorry, it took me a long time to reply. Thank you very much for your answer. I have not solved my problem yet. I don't understand the code. Do you need to put it in a new measure or column? I'll keep doing tests. Thanks
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 21 | |
| 10 | |
| 9 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 34 | |
| 31 | |
| 19 | |
| 13 | |
| 10 |