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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
mskarasha
Frequent Visitor

Daily Count Between Dates for each Region

Hello,

 

I have a table that spans across multiple months that shows the cumulative for each district throughout that month.

 

I need a calculated column that calculates the daily count for each district. 

 

Once the month ends, it needs to restart. So on July 1st, the daily count is essentially the cumulative amount, since it's day 1

 

Example of what I'm looking for:

DATEDISTRICTCUMULATIVEDAILY COUNT
6/15/2022    District 1        193611466
6/15/2022     District 2       10328876
6/15/2022     District 3        7229735
6/16/2022     District 1      20521           1160             
6/16/2022    District 2     10943615
6/16/2022    District 3     7724495

...(remaining June dates)

DATEDISTRICTCUMULATIVEDAILY COUNT
7/01/2022       District 1       1501                 1501                  
7/01/2022District 2718718
7/01/2022District 3505505
7/02/2022District 128081307
7/02/2022District 21252 534
7/02/2022District 3703 198

 

 

1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@mskarasha,

 

Try this calculated column:

 

DAILY COUNT = 
VAR vDate = Table1[DATE]
VAR vPrevDate =
    CALCULATE (
        MAX ( Table1[DATE] ),
        ALLEXCEPT ( Table1, Table1[DISTRICT] ),
        Table1[DATE] < vDate
    )
VAR vPrevAmount =
    CALCULATE (
        SUM ( Table1[CUMULATIVE] ),
        ALLEXCEPT ( Table1, Table1[DISTRICT] ),
        Table1[DATE] = vPrevDate
    )
VAR vResult =
    IF (
        DAY ( Table1[DATE] ) = 1,
        Table1[CUMULATIVE],
        Table1[CUMULATIVE] - vPrevAmount
    )
RETURN
    vResult

 

DataInsights_0-1660222219065.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

2 REPLIES 2
DataInsights
Super User
Super User

@mskarasha,

 

Try this calculated column:

 

DAILY COUNT = 
VAR vDate = Table1[DATE]
VAR vPrevDate =
    CALCULATE (
        MAX ( Table1[DATE] ),
        ALLEXCEPT ( Table1, Table1[DISTRICT] ),
        Table1[DATE] < vDate
    )
VAR vPrevAmount =
    CALCULATE (
        SUM ( Table1[CUMULATIVE] ),
        ALLEXCEPT ( Table1, Table1[DISTRICT] ),
        Table1[DATE] = vPrevDate
    )
VAR vResult =
    IF (
        DAY ( Table1[DATE] ) = 1,
        Table1[CUMULATIVE],
        Table1[CUMULATIVE] - vPrevAmount
    )
RETURN
    vResult

 

DataInsights_0-1660222219065.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




This worked perfectly, thank you!

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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
Top Kudoed Authors