Need help with latest value

I have sample data as follows

I need to create the desired output table as shown in screen shot. I am not sure how this can be achieved with the data I have.

  • In the desired output, I need to get the latest value based on timestamp and id which is shown as installed (latest values) column.
  • In the value1(cumulative sum) field it should be sum of the values1 column values by each id across all the timestamps. For example: ID: sdgfd , installed latest value is july 23 which has a values of 195 and for value1(cumulative field) it should be sum of cells from D3:D6.

Hi @Manoj_Virigineni,
I’ll break down for each question:

To populate the most recent timestamp for each id:

maxOver({timestamp}, [id], PRE_AGG)

For the 'installed (latest values) output, once you’ve setup the previous step you can use that in this calculated field:

maxOver(ifelse({Recent Date} = {Order Date}, Sales, NULL), [Country], PRE_AGG)

Last, for ‘value1’, you can do something like the following:

sumOver({value1}, [id], PRE_AGG)

Let me know if you have any additional questions or if this helps solve your case!

2 Likes

Hi @Brett,

Thanks for your reply and the solution you have provided was perfect.

Best,
Manoj

1 Like