Say you have order data that looks like this, and want to add additional column for last ordered date of each customer.

First, group the data by Customer ID.

Then, add a column with mutate like this.

Since the data is grouped, max(Order Date) here means maximum value within each customer, which means the last ordered dates of customers.

Click Run, and you will see the last_order_date column added.

You can ungroup, when grouping is not necessary for further data wrangling any more.

Here is the resulting table with the example data shown above.

Loading...

Here is bar chart showing distribution of orders by their customer’s last ordered date.

Loading...