☝️Small business or a startup? See if you qualify for our special offer.
+

Custom formula to compute consecutive purchases by customers

Answered
Leonardo asked 3 days ago

Hi,

I have a specific use case where I need to check for consecutive purchases by customers and display this information in a pivot table. For example, suppose you have customer rows, and you want to test whether they have made purchases within the last X months (where X can be customized, such as the last 2 months or the last 4 months consecutively).

Would it be possible to implement such a use case in Flexmonster?

 

Thank you in advance.

1 answer

Public
Maksym Diachenko Maksym Diachenko Flexmonster 2 days ago

Hello, Leonardo!

Thank you for reaching out to us.

Yes, it is possible to implement this use case in Flexmonster. Your request involves multiple aspects, so we would like to break it down and cover the key steps before tracking consecutive purchases - showing and filtering purchases within the last X months.

Pass the data to Flexmonster in the correct format.
The dataset should be structured so that each row represents an individual purchase. Both purchase and customer information should be present in each row. You can pass the data either in CSV or JSON format. Please check the following articles for more information about connecting to these data sources:

Configure the date field.
Set the "date string" date type to date via mapping - report configuration object that defines how fields from the data source are treated and presented within the component. Setting this type is necessary for using date filters.

mapping: {
purchase_date: { type: "date string" }
}

Set the date filter.
Flexmonster provides an "after" filter, which can be accessed from the UI, set in the report or programmatically using setFilter() API call. With this filter, you can show dates after the specified date, which covers your use case for showing the data for the last X months.

filter: {
query: { after: "2025-02-01" }
}

 

Configure the slice

You can define the fields that would be displayed in the slice. We have prepared an example with a simple layout showing purchases with users in rows and dates in columns: https://jsfiddle.net/flexmonster/1zdygb6n/

This setup provides a foundation for tracking consecutive purchases within a specific timeframe. If you need help improving the visualization, please let us know what specific fields and values you want to show in the pivot table.

Looking forward to hearing your feedback.

Best Regards,
Maksym

Please login or Register to Submit Answer