Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi all,
I have a table with one or more order_ids per customer_id, and I'm trying to flag customers who have more than one order_id as 'return' customers.
As an example below: I have customer_id and order_id, but I'm trying to populate customer_type.
order_ids 001, 002, 003, 004, and 005 have multiple records of the same customer_id, so I wish to flag that customer as 'Return'. order_id 006 only has one customer_id in the table, so I wish to flag that customer as 'New', etc.
Has anyone tried to do this?
I tried to first count the number of orders per customer, then use another field to say 'if # of orders > 1 then return else new', but my formula returns 1. All of the solutions I have tried gives me 1.
Here's one of the formulas I tried:
Solved! Go to Solution.
returning =
var customerID = 'Table (3)'[customerID]
var orders =
CALCULATE(
DISTINCTCOUNT( 'Table (3)'[orderId] )
,REMOVEFILTERS( 'Table (3)'[orderId] )
)
RETURN
IF( orders > 1, "Returning", "New" )
This worked perfectly, thank you for your reply!
returning =
var customerID = 'Table (3)'[customerID]
var orders =
CALCULATE(
DISTINCTCOUNT( 'Table (3)'[orderId] )
,REMOVEFILTERS( 'Table (3)'[orderId] )
)
RETURN
IF( orders > 1, "Returning", "New" )
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 59 | |
| 43 | |
| 42 | |
| 23 | |
| 17 |
| User | Count |
|---|---|
| 190 | |
| 122 | |
| 96 | |
| 66 | |
| 47 |