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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
NewbieJono
Post Partisan
Post Partisan

Count each day if case open

Hello, how would i calculate if a case is open on a date. e.g the data shows case 1 was open during each day in April. case 2 case was open each day in April and may. i will also need to make a case each day if it is still open.

 

i basically want to show the live queue of cases.

 

i have a date table set up and its link to my table.

 

Below is a cut down snapshot

 

 

Capture.PNG

 

1 ACCEPTED SOLUTION

Hi @NewbieJono - Ok, To display the active cases, on dates can you create below measure.

 

ActiveCasesCount =
CALCULATE(
COUNTROWS(Cases),
FILTER(
Cases,
Cases[StartDate] <= MAX(DateTable[Date]) &&
(ISBLANK(Cases[EndDate]) || Cases[EndDate] >= MAX(DateTable[Date]))
)
)

Measure to Determine if a Case is Open on a Given Date, below flag helps and checks if a case is active on a particular date

 

Slight change 

IsCaseOpen =
VAR SelectedDate = MAX('Date'[Date])
RETURN
IF(
CALCULATE(
COUNTROWS('Cases'),
FILTER(
'Cases',
'Cases'[StartDate] <= SelectedDate &&
(ISBLANK('Cases'[EndDate]) || 'Cases'[EndDate] >= SelectedDate)
)
) > 0,
1,
0
)

 

Try the above approach for active cases and flag.  still issue exist, pls share some sample data.

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





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

Proud to be a Super User!





View solution in original post

5 REPLIES 5
rajendraongole1
Super User
Super User

Hi @NewbieJono Create a measure to determine if a case is open on a given date

 

Hope you already created a seperate date table and modify the dates as start date and close dates as per your model design. currently i am using End date.

 

IsCaseOpen =
VAR SelectedDate = MAX('DateTable'[Date])
RETURN
CALCULATE(
COUNTROWS('Cases'),
FILTER(
'Cases',
'Cases'[StartDate] <= SelectedDate && (ISBLANK('Cases'[EndDate]) || 'Cases'[EndDate] >= SelectedDate)
)
)

 

to find the total open cases:

TotalOpenCases =
CALCULATE(
COUNTROWS('Cases'),
FILTER(
'Cases',
'Cases'[StartDate] <= MAX('DateTable'[Date]) && (ISBLANK('Cases'[EndDate]) || 'Cases'[EndDate] >= MAX('DateTable'[Date]))
)
)

The above measure display open cases for each month along with total opencases.

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





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

Proud to be a Super User!





Thanks for your help, but I'm not getting the output I was looking for. I want a line chart to show on the 1st of April, there were six active cases. And as the months go on, the cases would decrease as they get closed. By the time we hit July, there would only be 2 cases left.

 

but I would like to show this on a daily level. So the example dataset from April 1st to 5th will show 6 cases total, then it would drop to 5 on the 5th because one gets closed.

 

Sorry if this does not make much sense!

 

 

Hi @NewbieJono - Ok, To display the active cases, on dates can you create below measure.

 

ActiveCasesCount =
CALCULATE(
COUNTROWS(Cases),
FILTER(
Cases,
Cases[StartDate] <= MAX(DateTable[Date]) &&
(ISBLANK(Cases[EndDate]) || Cases[EndDate] >= MAX(DateTable[Date]))
)
)

Measure to Determine if a Case is Open on a Given Date, below flag helps and checks if a case is active on a particular date

 

Slight change 

IsCaseOpen =
VAR SelectedDate = MAX('Date'[Date])
RETURN
IF(
CALCULATE(
COUNTROWS('Cases'),
FILTER(
'Cases',
'Cases'[StartDate] <= SelectedDate &&
(ISBLANK('Cases'[EndDate]) || 'Cases'[EndDate] >= SelectedDate)
)
) > 0,
1,
0
)

 

Try the above approach for active cases and flag.  still issue exist, pls share some sample data.

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





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

Proud to be a Super User!





Actually, i think this was not working because I had a relationship set up. should I remove the link?

Hi @NewbieJono 

Yes.  You should have the calendar table as a disconnected table for the flexible duration analysis to work.  

Best regads,

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors