Forum Discussion

joep78's avatar
joep78
Helper III
6 years ago
Solved

Count open orders per month

Hi all,

 

I'm looking for a solution for the follwoing user story:

 

We want to count all open issues per each month whereby the ClosedDate is null or not in the same month. 

 

I formatted the table in an Excel example:

 

OrderAcceptedDateClosedDate
11-1-202015-1-2020
23-1-202018-1-2020
35-1-2020null
47-1-20202-2-2020
57-1-202031-1-2020
61-2-2020null
73-2-2020null
85-2-202018-2-2020
97-2-202020-2-2020
107-2-202018-3-2020
113-3-2020null
124-3-2020null
135-3-2020null
146-3-202015-3-2020
157-3-202020-3-2020
169-3-2020null
179-3-2020null
1810-3-2020null
1911-3-2020null
2020-3-2020null

 

the outcome should be as follow:

monthamount of new tickets amount of open tickets
152
254
31011

 

Let's take Month 1 as an example, there are 5 new tickets but 2 of them were still open at the end of January since the Closed date is either null or in the next month. same for february and march ofcourse. 

 

What options do I have to create this kind of outcome, I hope somebody has an idea and can help me out with this!

 

Thanks in advance for feedback!

 

Greetz Joep

3 Replies

  • Hi amitchandak ,

     

    Thanks for your quick reply, I will dive into your blog and your example file but after a quick scan, this solution fits my user story. I will let you now via the SOLUTION as soon as I'm ready!

     

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi joep78 ,

     

    Please check the following setps.

    1# Create a CALENDAR table and a calculated column "Month".

     

    CALENDAR = CALENDAR(MIN('Table'[AcceptedDate]),MAX('Table'[ClosedDate]))
    month = MONTH('CALENDAR'[Date])

     

     2# Create measures as below.

     

    amount of new tickets = CALCULATE(COUNT('Table'[Order]),FILTER(ALLSELECTED('Table'),'Table'[AcceptedDate].[MonthNo]=SELECTEDVALUE('CALENDAR'[month])))
    amount of open tickets = CALCULATE(COUNT('Table'[Order]),FILTER(ALLSELECTED('Table'),'Table'[AcceptedDate].[MonthNo]<=SELECTEDVALUE('CALENDAR'[month])&&('Table'[ClosedDate]=BLANK()||'Table'[ClosedDate].[MonthNo]>SELECTEDVALUE('CALENDAR'[month]))))

     

    3# Result would be shown as below.

     

    Best Regards,

    Jay

    Community Support Team _ Jay Wang

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