Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowGet inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.
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" )
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.