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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
Anonymous
Not applicable

Count status end of each month

Hi - hoping someone can help with the DAX needed for a measure to do the following

 

I have a table of data which has an open date and close date in it. I need to be able to create a line graph which shows the number of cases that were open at the end of each month on a month by month basis. 

 

Thanks

 

CaseData.PNG

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I have now resolved this by adding a Month Start and Month End Column to my Calendar reference table and then building the following measure:

 

CountOpenME = 
CALCULATE (
    COUNT( 'Table'[Stud ID] ),
    FILTER (
        GENERATE ( 'Table', 'Calendar' ),
        'Table'[Open Date] <= 'Calendar'[MonthEnd]
            && OR('Table'[Close Date] > 'Calendar'[MonthEnd],'Table'[Close Date]=BLANK())
    )
)

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous ,

You can try to use following measure if it suitable for your requirement:

Measure =
VAR currDate =
    MAX ( Date[Date] )
RETURN
    CALCULATE (
        COUNT ( Table[Column] ),
        FILTER (
            ALLSELECTED ( Table ),
            [OpenDate] <= currDate
                && OR ( [CloseDate] > currDate, [CloseDate] = BLANK () )
        )
    )

Regards,

Xiaoxin Sheng

Anonymous
Not applicable

Thank you - however, this isn't quite doing what I need it to.

 

To calrify - my calendar table has dates spanning 100 years as a reference table. 

 

I am trying to get the data in the example in my first post to look like this:

Openatmonthend.PNG

Thanks

KH

Anonymous
Not applicable

I have now resolved this by adding a Month Start and Month End Column to my Calendar reference table and then building the following measure:

 

CountOpenME = 
CALCULATE (
    COUNT( 'Table'[Stud ID] ),
    FILTER (
        GENERATE ( 'Table', 'Calendar' ),
        'Table'[Open Date] <= 'Calendar'[MonthEnd]
            && OR('Table'[Close Date] > 'Calendar'[MonthEnd],'Table'[Close Date]=BLANK())
    )
)

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.