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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
superhayan
Helper I
Helper I

[NEED HELP] Calculate COUNT of Blank Row with Conditions and plot a Monthly Chart

Hello all, I am stuck with a problem I need to plot a monthly chart of open compliance cases.

 

The example data is as below. The case that has no close date yet is regarded as still open. So basically I need to count the no. of case that has BLANK close date with create date smaller than the end of every month (that is to include all cases that already exist by the end of each month).  I have created a Calendar table that is linked to the close date. The chart will use this Calendar [date] as x-axis because on the same chart I also need to show no. of closed cases by month (   =CALCULATE(COUNT([Case Close Date]), [Current Status] = "Closed")     ). 

 

Compliance Case IDCase Create DateCase Close DateCurrent Status
101/05/202201/08/2022Closed
201/11/2022 Waiting for info
301/03/202301/03/2024Closed
401/04/202301/04/2024Closed
501/05/2023 In Progress
601/07/202301/01/2024Closed
701/10/2023 In Progress
801/01/2024 In Progress
901/03/202401/05/2024Closed
1001/04/2024 In Progress
1101/04/2024 Waiting for info

 

The final product willl be similar to this ( I know how to get the yellow line. Just stuck on how to get the blue line.) 

superhayan_1-1716770211589.png

I tried the below measure but it gets incorrect result. Is it becuase the create date has no relationship to the calendar table so it cannot generate the correct result? If so, how can I achieve the above chart when also showing no. of close cases each month?

 

=CALCULATE(
COUNT('Table'[Complaince Case ID]),
ISBLANK('Table'[Case Close Date]),
'Table'[Case Created Date] <= EOMONTH(MAX('Calendar'[Date]),0))

 

Thank you!!!

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_1-1716783253310.png

 

 

Jihwan_Kim_0-1716783222104.png

 

Close Case: = 
COUNTROWS (
    FILTER (
        Case_Fact,
        Case_Fact[Case Close Date] >= MIN ( Calendar_Dim[Date] )
            && Case_Fact[Case Create Date] <= MAX ( Calendar_Dim[Date] )
    )
)

 

 

Open Case: = 
COUNTROWS (
    FILTER (
        Case_Fact,
        Case_Fact[Case Close Date] = BLANK()
            && Case_Fact[Case Create Date] <= MAX ( Calendar_Dim[Date] )
    )
)

 

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.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

View solution in original post

1 REPLY 1
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_1-1716783253310.png

 

 

Jihwan_Kim_0-1716783222104.png

 

Close Case: = 
COUNTROWS (
    FILTER (
        Case_Fact,
        Case_Fact[Case Close Date] >= MIN ( Calendar_Dim[Date] )
            && Case_Fact[Case Create Date] <= MAX ( Calendar_Dim[Date] )
    )
)

 

 

Open Case: = 
COUNTROWS (
    FILTER (
        Case_Fact,
        Case_Fact[Case Close Date] = BLANK()
            && Case_Fact[Case Create Date] <= MAX ( Calendar_Dim[Date] )
    )
)

 

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.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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