Forum Discussion

Amik_singh's avatar
Amik_singh
Advocate I
8 months ago
Solved

Identifying New Customer Sales

I need to create a measure that only calculates sales for 'New Customers.' A customer is considered 'New' only in the month of their very first purchase. If they buy again a month later, they are 'Re...
  • Amar_Kumar's avatar
    8 months ago

    hey Amik_singh revert with more information if below suggested measure doesn't help. Sentence After -- is a comment for better context.


    New Customer Sales =
    VAR CurrentCustomers = VALUES('Sales'[CustomerID])
    VAR EndDate = MAX('Date'[Date])

    -- Find customers whose first purchase date falls within the currently selected period
    VAR NewCustomers = FILTER(CurrentCustomers,
    VAR FirstPurchaseDate =
    CALCULATE( MIN('Sales'[OrderDate]),
    ALL('Sales') -- Look at their entire history
    )
    RETURN
    -- Check if their first purchase happened in the visible date range
    FirstPurchaseDate IN VALUES('Date'[Date])
    )

    RETURN
    CALCULATE([Total Sales], KEEPFILTERS(NewCustomers))