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
Bruno_OMB
Regular Visitor

Count quantity per month

Hi!
I've been through this since trying to find help with a report I'm developing.
Basically, I have a table of records with columns ID, Start and End, where I want to count the number of active records by date (mm/yy).
As we can see, not all records have End , as they are still active on the current date.
The idea is to visualize the number of active records per month, considering the entry date and (if any) exit date.
Thanks for any help.

Bruno_OMB_0-1671478792324.png

 

1 ACCEPTED SOLUTION
samdthompson
Memorable Member
Memorable Member

Hello, this works pretty well for me. It does need you to make a inactive relation ship between the date and fact table date:end date2022-12-20_13-06-04.png

 

RunningTotal_CountOfOpenRecords =
TOTALYTD(
    COUNTROWS(Test),
    'Date'[Date])-
CALCULATE(
    TOTALYTD(
        [OpenRecordsPerMonth],
        'Date'[Date]),
    USERELATIONSHIP(
        'Date'[Date],
        Test[End]))
// if this is a solution please mark as such. Kudos always appreciated.

View solution in original post

4 REPLIES 4
samdthompson
Memorable Member
Memorable Member

Hello, this works pretty well for me. It does need you to make a inactive relation ship between the date and fact table date:end date2022-12-20_13-06-04.png

 

RunningTotal_CountOfOpenRecords =
TOTALYTD(
    COUNTROWS(Test),
    'Date'[Date])-
CALCULATE(
    TOTALYTD(
        [OpenRecordsPerMonth],
        'Date'[Date]),
    USERELATIONSHIP(
        'Date'[Date],
        Test[End]))
// if this is a solution please mark as such. Kudos always appreciated.

Thanks! They don't necessarily use their formula, but from it I managed to get what I needed in my production environment.

samdthompson
Memorable Member
Memorable Member

Hello, something like this should work:

 

OpenRecords=
CALCULATE(COUNTROWS(Table1),FILTER(Table1,Table1[End]<>""))

Obvs, you'll need to change the table name etc. The relationship to the date table will need to be made to the Start column.

 

Cheers

// if this is a solution please mark as such. Kudos always appreciated.

I tried to follow this line of reasoning, but it does not accumulate monthly.
Example, considering a record with Start:2012-01-01 and End:2012-03-30. I understand that this record should be listed in months 01, 02 and 03 (when, for example, displayed in a Matrix).

Helpful resources

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

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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