Customer history column

In this example, the goal is to add a column to the customer dimension table that groups the customers into four categories based on the date of their first purchase. Specifically, the new column needs to leverage the existing first purchase date column and assign the customer rows to one of the following four categories—First Year Customer, Second Year Customer, Third Year Customer, Legacy Customer. Since the column will be computed daily with each scheduled refresh, it will be used by the sales and marketing teams to focus their efforts on new and older customer segments.

A combination of date functions and conditional logic (if..then..else) is used with the Table.AddColumn() function to produce the new column:

Get Mastering Microsoft Power BI now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.