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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
cdfizz17
New Member

DAX Measure - Graph Active Cases Over Time

Hello,

 

I'm writing a measure to calculate the total "active" help desk cases at any point in time.

Cases are "active" between their [EntryDate] and [CloseDate] inclusive.

 

I want to graph this data over time in a line chart, and I want to adjust the time window using a date slicer.

I have a 'Date' table and a 'Cases' table, with [Date] 1:* [EntryDate].

 

Cases with an [EntryDate] outside the date window should still be counted if they are active inside the date window. I've accomplished this by using ALL('Cases') in my DAX (see below).

 

The problem is, I also want to filter the measure by [Dept]. I don't see how I can do this while using ALL('Cases'). How can I solve this problem?

 

CaseVolume =
VAR vol =
    CALCULATE (
        COUNT ( 'Cases'[CaseID] ),
        FILTER (
            ALL ( 'Cases' ),
            'Cases'[EntryDate] <= MAX ( 'Date'[Date] )
                && (
                    'Cases'[CloseDate] >= MAX ( 'Date'[Date] )
                        || ISBLANK ( 'Cases'[CloseDate] )
                )
        )
    )
RETURN
    IF ( ISBLANK ( vol ), 0, vol )

 

Case Table:

screenshot.png

 

2 REPLIES 2
Jihwan_Kim
Super User
Super User

HI,

Please try using ALLSELECTED DAX function.

 

ALLSELECTED function (DAX) - DAX | Microsoft Learn


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Thank you for the answer. Unfortunately, there is still an issue.

 

On 17th May, there were 45 active cases. Using ALLSELECTED, only 19 are counted. There are 26 missing from the total. They are filtered out by the date slicer, because the [EntryDate] is before 17th May...

 

screenshot.png

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.