Which product was our 2nd most frequently purchased by each person?

TG Database is a platform for organized data management.
Post Reply
phonedata
Posts: 24
Joined: Mon Dec 23, 2024 3:40 am

Which product was our 2nd most frequently purchased by each person?

Post by phonedata »

Instead of returning a Maximum() function we use the SelectNth() function and choose the 2nd when ordered from Largest to Smallest. I have chosen to return the actual category value, but I could have also chosen to return the numeric value.

"Group transactions by" table

Below is a screenshot showing the croatia phone number example same 2 people as above, but now we can see highlighted the transactions that contribute to Greece being recorded as the 2nd highest spend destination for both of these 2 people.

Details of bookers

How many products have I spent more than a given amount on?
In this example we will build on the previous analysis and find all of the destinations where the Sum(Cost) is over £200. For this we can use the InRange function and set a minimum threshold value for the group results.

Table with details in

This example is slightly different in that it could return anywhere between 0 or all of the possible destinations, so a flag array will be created of the Destinations that meet our required criteria. We can then use existing expression functions to count the populated flags (How many destinations have we spent more than X on) or to simply list them out as we have done in the screenshot below. Our two example people have 1 and 2 destinations respectively for which they have met the required criteria.
Post Reply