Forum Discussion

powerbiexpert22's avatar
powerbiexpert22
Icon for Impactful Individual rankImpactful Individual
2 years ago
Solved

new customers

i need to find customers who never placed order before given date   example vishal is new customers on date 10-06-2002                                   
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi powerbiexpert22 

     

    Thanks for the reply from Jihwan_Kim , please allow me to provide another insight:

    I create a set of sample data, and add a calculate column on order table:

     

    customername = RELATED(customer[name]) 

     

     

    Then add a calender table:

     

    Table = CALENDARAUTO()

     

    Then create a measure:

     

    MEASURE =
    VAR _getdate =
        MAX ( 'Table'[Date] )
    VAR _getname =
        FILTER (
            SUMMARIZE (
                ADDCOLUMNS (
                    'order',
                    "_mindate",
                        CALCULATE (
                            MIN ( 'order'[orderdate] ),
                            FILTER (
                                ALL ( 'order' ),
                                'order'[customerid] = EARLIER ( 'order'[customerid] )
                            )
                        )
                ),
                [customername],
                [_mindate]
            ),
            [_mindate] >= _getdate
        )
    RETURN
        CONCATENATEX ( _getname, [customername], "; " )

     

    Then add a slicer:

    And a card:

    You can select the date from the slicer, and the outcome is the customername who never placed order before the selected date, the result is as follow:

     

    Best Regards

    Zhengdong Xu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.