Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago

DAX - Count by Week by Customer Based on another Measure

I'm working with two different tables, a Sales Line table and a Date Dimension. I have a measure in my Sales Line table that counts the distinct number of times a Sales Order # appears (Ex: US1234---since it is sales line it can appear multiple times). 

 

Measure name: DistinctSalesOrders

 

I want to count the number of times a customer orders more than once in a week. 

 

Ex: 

CustomerSales OrderProductquantitydate
XYZUS1234a11/1/2014
XYZUS5555b21/2/2014
XYZUS4444c31/3/2014

 

Week 1 the customer ordered three times.. therefore I would count this as 1. 

 

In essence, I want to  Count when distinct orders by customer is > 1 in a given week.

1 Reply