Forum Discussion

Laufer_Israel's avatar
5 years ago
Solved

count duplicate dates per Customer ID

Hi all, I have the below data: ID     Date     Order Type 1      09/12      regular 1      09/13      regular 1      09/14      regular 1      09/15      regular 1      09/15       digital   ...
  • v-yingjl's avatar
    v-yingjl
    5 years ago

    Hi Laufer_Israel ,

    Based on your description, you can create this measrue to count:

    Count =
    VAR tab =
        FILTER (
            ALL ( 'Table' ),
            CALCULATE (
                COUNTROWS ( 'Table' ),
                FILTER (
                    ALL ( 'Table' ),
                    'Table'[ID] = EARLIER ( 'Table'[ID] )
                        && 'Table'[Date] = EARLIER ( 'Table'[Date] )
                )
            ) >= 2
        )
    RETURN
        COUNTX (
            FILTER (
                tab,
                [ID]
                    IN DISTINCT ( 'Table'[ID] )
                        && [Date]
                            IN DISTINCT ( 'Table'[Date] )
                                && [Order Type] = "regular"
            ),
            [Order Type]
        )
    

    Attached a sample file in the below, hopes to help you.

     

    Best Regards,
    Community Support Team _ Yingjie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.