3 Replies Latest reply: Jul 23, 2013 1:37 AM by alando larosee RSS

    FirstSortedValue is returning NULL values

      Hi,
      
      This is my first post. I hope I can give as much details as possible. Below is a tiny sample of the data.
      
      Date                                     Storage                                        Litres
      01/05/13                               Tank1                                         10500
      03/05/13                               Tank2                                           9000  
      03/05/13                               Tank1                                          8000
      05/05/13                          ServiceTruck                                    2500
      
      
      What I need to achieve is for each Storage, i need their very first reading at the beginning of each month.
      
      I have tried to use FirstSortedValue but for some reason I get null values under litres:
      
      Load
      Monthname(Date) as DipMonth,
      Storage,
      Litres as Dip_litres,
      FirstSortedValue(Litres, Monthname(Date)) as Dip_litres1
      RESIDENT Fuel_Dip
      Group by
      Monthname(Date),
      Storage;
      
      Can anyone show me what is the best way of getting the first reading for each month for each Storage tank/truck please?
      
      Thank you