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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
mccollough
Helper I
Helper I

Calculate new clients over time

Let's say you want to trend the number of distinct client ID's over time from a table of invoices.

I have an invoice table that looks like this

DateClient IDSale Amount
1/1/2021   100$100
1/1/2021   223$100
1/2/2021   100$50
1/3/2021   270$100
1/3/2021   100$100
1/4/2021   223$50
1/5/2021   270$100
1/6/2021   400$100
1/6/2021   550$50
1/6/2021   660$100
1/6/2021  700$100
1/7/2021  100$50

 

And I want to produce something that looks like this 

DateClient Count
1/1/2021   2
1/2/2021   2
1/3/2021   3
1/4/2021   3
1/5/2021   3 
1/6/2021   7
1/7/2021   7

 

I've already successfully created a table of distinct dates and I've tried to aggregate Client IDs with SUMMARIZECOLUMNS but I've only been able to show the number of distinct IDs that occur on each date. 

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

This looks like a standard cumulative total pattern.

Client Count = 
VAR CurrDate = MAX ( dimDate[Date] )
RETURN
    CALCULATE ( DISTINCTCOUNT ( Table1[Client ID] ), dimDate[Date] <= CurrDate )

View solution in original post

3 REPLIES 3
AlexisOlson
Super User
Super User

This looks like a standard cumulative total pattern.

Client Count = 
VAR CurrDate = MAX ( dimDate[Date] )
RETURN
    CALCULATE ( DISTINCTCOUNT ( Table1[Client ID] ), dimDate[Date] <= CurrDate )

You're a wizard Harry

 

Thank you so much for the help!!!

smpa01
Super User
Super User

@mccollough   you can use a measure like this

Measure = 
VAR _date =
    MAX ( 'Table'[Date] )
RETURN
    COUNTROWS (
        EXCEPT (
            VALUES ( 'Table'[Client ID] ),
            SUMMARIZE (
                FILTER ( ALL ( 'Table' ), 'Table'[Date] < _date ),
                'Table'[Client ID]
            )
        )
    )

 

smpa01_0-1637178931996.png

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.