Requirements

  • Have a place list

Nice to have

  • Relevant teams name

  • Have the field _type filled in the place list

You can find a workshop dedicated to the customer segmentation based on the activity here.

Video for more explanations here

Step 1: Create a calculated attribute days_to_last_visit in the place list

  • Create a calculated attribute name days_to_last_visit (attribute type: single choice)

  • Create 3 options:

Label

Tag

Less than 7days

seven_days

Less than 30 days

thirty_days

More than 30 days

more_than_thirty_day

  • Copy/Paste the query in the SQL query

    WITH tab0 AS (SELECT
    EXTRACT(DAY FROM NOW() - _last_visit_date::date) as difference
    FROM 
    l_place
    WHERE l_place._id='$item_id$')
    
    SELECT
    CASE
    WHEN difference < 8 THEN 'seven_days'
    WHEN difference < 31 THEN 'thirty_days'
    ELSE 'more_than_thirty_day'
    END
    FROM
    tab0
    CODE

You need to keep the same option tags and the same

Step 2: Create a new dashboard based on a json file

Download the json file and upload it in a new dashboard. (How to upload a json file here)

customer_segmentation.json

Step 3 (optional) : Create a mapping between the option tags and the labels

If you don’t have explicit options for the field _type in the place list (for example opt1, opt2, opt3, …), you need to implement a mapping in the dashboard to have the options displaying nicely in the dashboard..

How to create a mapping here