Is there any index field in your table? If this is a case, you can write a formula to use the index to find out the corresponding begin value and end value, then use them to get the average.
AVG Measure =
VAR _start =
MINX ( ALLSELECTED ( Table[index] ), [index] )
VAR _end =
MAXX ( ALLSELECTED ( Table[index] ), [index] )
LOOKUPVALUE ( Table[Amount], Table[index], _start )
+ LOOKUPVALUE ( Table[Amount], Table[index], _end ),
Otherwise, you need to add an index column first.(power bi data model does not contain a row/column index to find out first or last row value).
Hope this helps!!
If you are interested in learning Power BI, check out Power BI Course Topics now!