cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Syndicate_Admin
Administrator
Administrator

Count customers between dates if they haven't purchased before

Good morning, everyone,

Thanks in advance for the help. I have a question for a long time and I do not know how to solve it. I work with a table that I simulate below.

Frangranada_0-1669537625603.png

I want to know how to count customers for dates that I mark on the calendar, as long as they have not bought before. Ahem: If I mark in the calendar the dates from 21/11 to 24/11, the number of different clients is 5. Now, if I march alone on 11/23, then it's 2. What I want to achieve is that if I mark the day 24/11 instead of counting 5, only count me 2 (customer 3 and 5), since customers 1, 2 and 4 have bought on previous dates.

I hope I haven't messed up too much.

Thank you again for your help.

Greetings

1 ACCEPTED SOLUTION
v-kalyj-msft
Community Support
Community Support

Hi @Syndicate_Admin ,

According to your description, here's my solution. Create a calculated column.

Count =
SUMX (
    FILTER (
        'Table',
        'Table'[Clients] = EARLIER ( 'Table'[Clients] )
            && 'Table'[Date of purchase] = EARLIER ( 'Table'[Date of purchase] )
    ),
    IF (
        COUNTROWS (
            FILTER (
                'Table',
                'Table'[Clients] = EARLIER ( 'Table'[Clients] )
                    && 'Table'[Date of purchase] < EARLIER ( 'Table'[Date of purchase] )
            )
        ) + 0 = 0,
        1
    )
)

Put Date and the new column in a visual, get the correct result:

vkalyjmsft_0-1669618281784.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

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

View solution in original post

3 REPLIES 3
v-kalyj-msft
Community Support
Community Support

Hi @Syndicate_Admin ,

According to your description, here's my solution. Create a calculated column.

Count =
SUMX (
    FILTER (
        'Table',
        'Table'[Clients] = EARLIER ( 'Table'[Clients] )
            && 'Table'[Date of purchase] = EARLIER ( 'Table'[Date of purchase] )
    ),
    IF (
        COUNTROWS (
            FILTER (
                'Table',
                'Table'[Clients] = EARLIER ( 'Table'[Clients] )
                    && 'Table'[Date of purchase] < EARLIER ( 'Table'[Date of purchase] )
            )
        ) + 0 = 0,
        1
    )
)

Put Date and the new column in a visual, get the correct result:

vkalyjmsft_0-1669618281784.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

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

vanessafvg
Super User
Super User

please provide the sample data in text form.





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




The example table.

ClientsDate of purchaseUnits
Client 121/11/202235
Client 222/11/202248
Client 123/11/202212
Client 324/11/202224
Client 423/11/202256
Client 224/11/202224
Client 124/11/202236
Client 424/11/202212
Clinete 524/11/202218

The idea is to know for any day, the number of unique customers who have not bought since 21/11

Thank you

Helpful resources

Announcements
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

BizApps LATAM 2023

Business Application LATAM Summit 2023

Join the biggest FREE Business Applications Event in LATAM this February.

Power Platform Bootcamp

Global Power Platform Bootcamp

In this bootcamp we will deep-dive into Microsoft’s Power Platform stack with hands-on sessions and labs, delivered to you by experts and community leaders.