Calculate difference between two values in a graph - custom expression

Hi Guys

I am shwoing a data of pressure in a graph by date which can selected from the filter ( days, months, years) 

I would like to calculate the difference between the twos extremum data in the plot  [ last Value-  first Value] ( when user change a filter i show the new calculation as the graph will change )


here my custome expression but i not working properly ( Date is X axis values ) Level Pressure Y axis :

Abs(if([Property Name]="LevelPressure",[Average Reading])) - sum(if([Property Name]="LevelPressure",[Average Reading])) over (PreviousPeriod([Date]))