cancel
Showing results for 
Search instead for 
Did you mean: 

Last_version Filter usage in Incorta

rohankamath
Rocketeer

Hi ,
We are trying to use the Last_version filter in an aggregated table to get the counts of ID's for the last audit date for that ID. (v5.2.2)

This use case is generating some values but they dont seem to make any sense. We are unable to understand the logic that incorta is using to apply this function. 

As there was limited documentation for the feature, it would be helpful if you could provide more insight on the workings of this filter. 

 

Regards,

Rohan

2 REPLIES 2

Prince
Employee
Employee

Sorry misunderstood the question that you were using the lastVersion() function. Please refer to Patrick reply for the correct answer

Hi @rohankamath 

You can use the lastVersion() filter function as follows:

Syntax

 

 

firstVersion(<type> value, <type> group_by, date order_by)

 

 

  • value : an Incorta type
  • group_by : an Incorta type
  • order_by : date

Returns

Type of value

Notes

Returns the last occurrence of a value with respect to date (i.e. the order-by parameter). Unless used as a filter, this function must be used inside an aggregation function.

Example

 

 

count(lastVersion(SALES.SALES.AMOUNT_SOLD, SALES.SALES.CUSTOMER_ID, SALES.SALES.AUDIT_DATE))

 

 

 

more in the doc link: https://docs4.incorta.com/4.5/c-filter-functions/#example 

Do you want to share sample of your data and screenshot of your analyzer. The result is impacted by the grouping dimensions used in your aggregated table.

PatrickRafferty
Employee
Employee

Sure Rohan....

If I take this example of source data:

OrderIdOrderDateAmountProductId
13/1/2236
13/2/2226
24/4/2299
33/1/2268
34/2/2217
34/3/2248


Think of that table as a record of orders (there are 3 above) that are placed, and then updated over time.  I might apply a Last Version filter (or a First Version filter) to retrieve only the "last version" of the order:

OrderIdOrderDateAmountProductId
13/2/2226
24/4/2299
34/3/2248

To do that in Incorta, it would look like this:

PatrickRafferty_0-1662762473693.png

You drag on the "id" field into Individual Filter panel (think of it as the unique key of the result set or the group by), set the Operator to "Last Version" and then drag the Order Date on to the Values (think of it as the criteria by which we select the row that aligns to that unique key).

Hope that helps, this screenshot comes from an Incorta cloud instance if you wanted to take a look.

Thanks,

Patrick

VP Global Presales