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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Getting a running total of the number of rows after a given date but before another date?

So I have a table listing courses, with a "created_at" and an "expires_at" columns that have date values. I want to calculate the number of active courses for a long period, consisting of those courses that have been created but haven't been expired. I have a date table, simply called Dates and the Date column in Dates and the "created_at" column in courses are related. How do I calculate the number of courses offered on any given date?
This is what I wrote but it doesn't work. Returns a strange looking step graph for some reason.

Offered courses =
VAR Created = CALCULATE(
    COUNTA('courses course'[created_at]),
    FILTER(
        ALLSELECTED('Dates_early'[Date]),
        ISONORAFTER('Dates_early'[Date], MAX('Dates_early'[Date]), DESC)
    )
)

VAR Expired = CALCULATE(
    COUNTA('courses course'[expires_at]),
    FILTER(
        ALLSELECTED('Dates_early'[Date]),
        ISONORAFTER('Dates_early'[Date], MAX('Dates_early'[Date]), DESC)
    )
)
RETURN Created - Expired

Help?
1 REPLY 1
lbendlin
Super User
Super User

Please provide sanitized sample data that fully covers your issue. If you paste the data into a table in your post or use one of the file services it will be easier to work with. Please show the expected outcome.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

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

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