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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
IAM
Helper III
Helper III

My brain doesn't function, help! Count overdues in a month.

Hi all,

 

My brain stopped working, can you help me figure this out?

 

I have a tabel with a start and finsih date per month (So per row a First day and a Last day of the month) and I want to add a calculated column to count the number of tickets in another table that were OPEN and OVERDUE in the month of the period from that row.

 

But is it possible to count in the fact if the order was open and overdue that month?

 

So many variables right..

The column where I count it in
Report[First day]

Report[Last day]

 

But I also have the:

IW38[Date created]

IW38[Date finsihed]

IW38[Duedate]

 

I cant share a PBIX file, but can someone tell me if it is possible what I am trying to do here? 

 

 

1 ACCEPTED SOLUTION
Kedar_Pande
Community Champion
Community Champion

@IAM 

Calculated Column

OpenAndOverdueCount = 
VAR StartDate = Report[First day]
VAR EndDate = Report[Last day]

RETURN
COUNTROWS(
FILTER(
IW38,
IW38[Date created] <= EndDate &&
(ISBLANK(IW38[Date finished]) || IW38[Date finished] >= StartDate) &&
IW38[Duedate] < EndDate
)
)

💌If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn

 

View solution in original post

5 REPLIES 5
v-kaiyue-msft
Community Support
Community Support

Hi @IAM ,

 

You can try the following dax expression.

OpenAndOverdueTickets = 
VAR StartDate = Report[First day]
VAR EndDate = Report[Last day]
RETURN
CALCULATE(
    COUNTROWS(IW38),
    IW38[Date created] <= EndDate,
    IW38[Duedate] <= EndDate,
    IW38[Date finished] > EndDate || ISBLANK(IW38[Date finished])
)

vkaiyuemsft_0-1732243654408.png

 

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.

shafiz_p
Resident Rockstar
Resident Rockstar

Hi @IAM  Try below code to create a calculated column in Report table:

 

OverdueTickets = 
CALCULATE(
    COUNTROWS(IW38),
    IW38[Date created] <= Report[Last day],
    IW38[Duedate] <= Report[Last day],
    IW38[Duedate] >= Report[First day],
    ISBLANK(IW38[Date finished]),
    IW38[Duedate] < TODAY()
)

 

 

Considering you have relation between Report and IW#* table.

 

Hope this helps!!

If this solved your problem, please mark this is a solution and a kudos!!

 

Best Regards,
Shahariar Hafiz 

Kedar_Pande
Community Champion
Community Champion

@IAM 

Calculated Column

OpenAndOverdueCount = 
VAR StartDate = Report[First day]
VAR EndDate = Report[Last day]

RETURN
COUNTROWS(
FILTER(
IW38,
IW38[Date created] <= EndDate &&
(ISBLANK(IW38[Date finished]) || IW38[Date finished] >= StartDate) &&
IW38[Duedate] < EndDate
)
)

💌If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn

 

IAM
Helper III
Helper III

Thank you so much!

 

If I make the calculated column in IW38, I can only give the 0 or 1 for one specific month, right?

VahidDM
Super User
Super User

Hi @IAM 

 

Try this step-by-step approach to achieve this:

Create a Calculated Column for Overdue Tickets: First, you need to determine if a ticket is overdue. You can create a calculated column in your IW38 table to check if the ticket is overdue.

 

IW38[IsOverdue] = IF(IW38[Date finished] > IW38[Duedate], 1, 0)
Create a Calculated Column for Open Tickets: Next, you need to determine if a ticket was open during the month. You can create a calculated column in your IW38 table to check if the ticket was open during the month.

 

IW38[IsOpenDuringMonth] =
IF(
AND(
IW38[Date created] <= Report[Last day],
OR(
ISBLANK(IW38[Date finished]),
IW38[Date finished] >= Report[First day]
)
),
1,
0
)
Count Overdue and Open Tickets: Now, you can create a calculated column in your Report table to count the number of tickets that were both open and overdue during the month.

 

Report[OverdueOpenTickets] =
CALCULATE(
COUNTROWS(IW38),
FILTER(
IW38,
IW38[IsOverdue] = 1 &&
IW38[IsOpenDuringMonth] = 1 &&
IW38[Date created] <= Report[Last day] &&
(ISBLANK(IW38[Date finished]) || IW38[Date finished] >= Report[First day])
)
)
This approach should help you count the number of tickets that were open and overdue during the specified month. Make sure to adjust the column names and table names according to your actual data model.

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Appreciate your Kudos!! 

 

LinkedIn|Twitter|Blog |YouTube 

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 MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.