Forum Discussion
New Customers with order over a certain value - shopify data
- 8 years ago
Hi JackEnviro,
The formula below assumes that Created Date is column is when an order was created so any row that matches the earliest created date by customer and where Full Order = Full is the New Order.
New Order? = VAR FirstOrderDate = CALCULATE ( MIN ( ShopifyValues[Created Date ] ), ALLEXCEPT ( ShopifyValues, ShopifyValues[Customer ID] ), ShopifyValues[Customer ID] = EARLIER ( ShopifyValues[Customer ID] ) ) RETURN IF ( ShopifyValues[Full Order] = "Part", "N/A", IF ( FirstOrderDate = ShopifyValues[Created Date ] && ShopifyValues[Full Order] = "Full", "New", "Return" ) )
Then to exclude that - most customers are ordering a sample pack before making a full order so the first purchase transaction is not really a full order. The income from that can be analysed seperately.
I have already created a custom column to assign "Full" and "Part" orders which classifies the order as over £250.
What I am looking to see is the cost to aquire a customer vs the return from a new customer in the period or relative periods.
One of the bits I am finding difficult being new to Power Bi and DAX is that an order in the Shopify data is made up of multiple lines.
Hi JackEnviro,
The formula below assumes that Created Date is column is when an order was created so any row that matches the earliest created date by customer and where Full Order = Full is the New Order.
New Order? =
VAR FirstOrderDate =
CALCULATE (
MIN ( ShopifyValues[Created Date ] ),
ALLEXCEPT ( ShopifyValues, ShopifyValues[Customer ID] ),
ShopifyValues[Customer ID] = EARLIER ( ShopifyValues[Customer ID] )
)
RETURN
IF (
ShopifyValues[Full Order] = "Part",
"N/A",
IF (
FirstOrderDate = ShopifyValues[Created Date ]
&& ShopifyValues[Full Order] = "Full",
"New",
"Return"
)
)- JackEnviro8 years ago
Helper I
Thats great - thanks very much for your help!