Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Syndicate_Admin
Administrator
Administrator

How I accumulate clients different months

Hello Community,
Good day, someone can give me a light with the next problem in power BI.
Example: I have a list of clients in the course of the year where a client can be served more than once in the month and in the year, I need to count the unique new clients as they appear and accumulate them at the end of the year.

DATECUSTOMER
ENE-21KAREN
ENE-21KAREN
ENE-21PAOLA
ENE-21VAIN
21-febPAOLA
21-febANDREINA (NOWA)
21-febVAIN
21-febGABRIELA
mar-21KARINA
mar-21PAOLA
mar-21ANDREINA (NOWA)
mar-21KAREN
mar-21ANGELA
Apr-21CARLA
Apr-21YENNY
Apr-21ADELAIDE
Apr-21PAOLA
May 21SOFIA
May 21GIULIANNA
May 21ANDREINA (NOWA)
June 21-2PAOLA
June 21-2ANGELA
June 21-2ROSE
21-julCYNTHIA
21-julCYNTHIA
21-julPAULA
21-julPRISCILLA
21 years agoKAREN
21 years agoANGELA
21 years agoANGELA
21 years agoPAULETTE
UNIQUE PATIENTS17

Row 3 "Unique patients attended" is the one I need to calculate

JANUARYFEBRUARYMARCHAPRILMAYJUNEJULYAUGUST
NUMBER OF ATTENTIONS44543344
UNIQUE PATIENTS SEEN34544333
ACCUMULATED SINGLE PTES3571012141617

Thank you very much in advance

2 ACCEPTED SOLUTIONS

Ok. With this model:

Model.JPG

And these measures:

Number of attentions = COUNT(FactTable[CUSTOMER])
Distinct Customers = DISTINCTCOUNT(FactTable[CUSTOMER])

and..

New customers =
CALCULATE (
    DISTINCTCOUNT ( FactTable[CUSTOMER] ),
    FILTER (
        ALL ( 'Date Table' ),
        'Date Table'[Date] <= MAX ( 'Date Table'[Date] )
    )
)

 

You get the following:

Result.JPG

 

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

This should work:

New customers =
VAR _Year = SELECTEDVALUE ( Date Table [Year] )
CALCULATE (
    DISTINCTCOUNT ( FactTable[CUSTOMER] ),
    FILTER (
        ALL ( 'Date Table' ),
        'Date Table'[Date] <= MAX ( 'Date Table'[Date] )
        && Date Table [Year] = _Year
    )
)




Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

9 REPLIES 9
PaulDBrown
Community Champion
Community Champion

Do you have a date table in the model?





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Hello, if I have a date table, which I have attached to the date field of the list I published

Do you consider new client when the client first appears in the year? Does the count start at the beginning of each year?





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Hi yes, the count restarts every year and is considered a new customer when it appears for the first time in the year.

Sorry, could you please explain the relevance of the rows where Date = "21 years ago"?

Also, do the date values such as 21-feb or 21-july refer to year-month or date-month?

what do the rows for  Date = June 21-2 actually mean? (does your real data actually look like this??)

It would be very helpful is you provided a sample PBIX file via Dropbox, OneDrive, Google Drive...





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Sorry, the table was copied wrong when pasting it, the date field is in date format (DD/MM/YYYY) but pasting it here changes the format.

DATECUSTOMER
January/2021KAREN
January/2021KAREN
January/2021PAOLA
January/2021VAIN
February/2021PAOLA
February/2021ANDREINA (NOWA)
February/2021VAIN
February/2021GABRIELA
March/2021KARINA
March/2021PAOLA
March/2021ANDREINA (NOWA)
March/2021KAREN
March/2021ANGELA
April/2021CARLA
April/2021YENNY
April/2021ADELAIDE
April/2021PAOLA
May/2021SOFIA
May/2021GIULIANNA
May/2021ANDREINA (NOWA)
June/2021PAOLA
June/2021ANGELA
June/2021ROSE
July/2021CYNTHIA
July/2021CYNTHIA
July/2021PAULA
July/2021PRISCILLA
August/2021KAREN
August/2021ANGELA
August/2021ANGELA
August/2021PAULETTE
UNIQUE PATIENTS17

Ok. With this model:

Model.JPG

And these measures:

Number of attentions = COUNT(FactTable[CUSTOMER])
Distinct Customers = DISTINCTCOUNT(FactTable[CUSTOMER])

and..

New customers =
CALCULATE (
    DISTINCTCOUNT ( FactTable[CUSTOMER] ),
    FILTER (
        ALL ( 'Date Table' ),
        'Date Table'[Date] <= MAX ( 'Date Table'[Date] )
    )
)

 

You get the following:

Result.JPG

 

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Thank you very much, there is only something that does not come out, it does not restart in each year, it accumulates for all the years that there is customer service.

KrnVelez1_0-1630602611844.pngKrnVelez1_1-1630602662364.png


What would be the modification so that the beginning of each year is restarted?

Thanks a lot

This should work:

New customers =
VAR _Year = SELECTEDVALUE ( Date Table [Year] )
CALCULATE (
    DISTINCTCOUNT ( FactTable[CUSTOMER] ),
    FILTER (
        ALL ( 'Date Table' ),
        'Date Table'[Date] <= MAX ( 'Date Table'[Date] )
        && Date Table [Year] = _Year
    )
)




Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors