2 Replies Latest reply: Dec 4, 2012 5:59 AM by sujeet Singh RSS

    Aggr function help!?

      Hi All,


      I have hit a brick wall with the Aggr function. I basically want to show the latest record for a summary of spend, but ensure that the total spend is a sum of all prior records. The reason being that suppliers information changes over time and I just need the latest record of detail. I have created an indicator to give me the max date and the expression for the straight table is as follows:




      Now the indicator, when selected works in some cases, but in other cases, I am losing records. When I make other selections, Category for example, it throws my balances completely off. I tried applying this logic but it still doesnt balance:





      Anyone have any suggestions or similar experiences?

        • Re: Aggr function help!?
          Stefan Wühl

          I don't think that this




          is valid syntax, it seems you're missing the expression to aggregate in your sum() function.


          Then, just using set expression




          is just clearing any selections in Latest_record_indicator field, it is not filtering your data for latest records (or have I misunderstood what you are trying to show here?).


          Finally, I think you need an aggregation function around the aggr() function, to aggregate the table returned from the aggr() function (there are special cases where you don't explicitely need one, but in most cases, you do).


          Could you post a small sample app here?