Forum Discussion

craigology's avatar
craigology
Icon for Microsoft Employee rankMicrosoft Employee
4 years ago
Solved

Finding Monthly Unique New Customers

Scenario: EOM reporting for December and working from one master spreadsheet where new customers are inputted with new orders. The same customer might have ordered something in June and November so t...
  • Hanson97's avatar
    4 years ago

    Hi craigology 

    This is quite simple in Power BI

    1. Created a table called "Sample" to replicate your dataset. You can replace the col/table names with your dataset.

     

    2. Create a calculated column "Month Index" to keep track of month passed from a reference date (jan 2021 in my case).

    Month Index = DATEDIFF(DATE(2020,1,1), 'Sample'[Input Date ],MONTH)
     

     

    3. Create another calculated colmumn to check if users are Old/new

    Customer Profile = 
    VAR customerName = 'Sample'[Customer Name]
    VAR monthIndex = 'Sample'[Month Index] 
    VAR previousCount = CALCULATE(countrows('Sample'), filter(all('Sample'), 'Sample'[Customer Name] = customerName && 'Sample'[Month Index] < monthIndex))
    RETURN
    
    IF( previousCount > 0, "Old Customer", "New Customer")

     

    4. Create a label visual and add the "Distinct Count" of Customer Name column. Also add an additional filter on the visual to only count distinct count for "Customer Profile" to be "New Customer"


     

    Thats It! You can filter the table now using month filter (or any other filter) to see the uniqe count between the specified time span.


    If this helped you, mark this as the solution to help others refer.

    Thanks,
    Hanson