Forum Discussion
astronauta49
5 years agoHelper I
First value by date
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. Than...
- 5 years ago
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
daxer-almighty
5 years agoSolution Sage
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