cancel
Showing results for
Did you mean:

## 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.

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
Community Support

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:

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.

3 REPLIES 3
Community Support

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:

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.

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.

 Clients Date of purchase Units Client 1 21/11/2022 35 Client 2 22/11/2022 48 Client 1 23/11/2022 12 Client 3 24/11/2022 24 Client 4 23/11/2022 56 Client 2 24/11/2022 24 Client 1 24/11/2022 36 Client 4 24/11/2022 12 Clinete 5 24/11/2022 18

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

Thank you

Announcements

#### 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.

#### 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!

#### Business Application LATAM Summit 2023

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

#### 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.

Top Solution Authors
Top Kudoed Authors