cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dcs136
Advocate I
Advocate I

Count Open Incidents Weekly

Hi Guys!  

 

I'm trying to create some DAX to solve this problem, because I can't do this using my database.

 

Here is the thing!  

I want to create a chart that shows me all the Open Incidents Weekly.     

 

My source look like this

 

Submit DateResolved Date/Time
01/01/201702/01/2017
02/01/201705/01/2017
03/01/2017 
04/01/2017 
05/01/2017 
06/01/201707/01/2017
07/01/201709/01/2017
08/01/201720/01/2017
09/01/201720/01/2017
10/01/201720/01/2017
11/01/2017 

 

The output should be like this \/

YearMonthWeekNumber of Open Incidents
2017113
2017124
2017130
2017140
2017150

 

As you can see I'm using the last week day to count the Open Incident.

 

To do that in the database i used this formula below \/

 

((datediff(day, [Submit Date], [CalendarDate]) >= 0) AND ((datediff(day, [Resolved-Date/Time], [CalendarDate]) <= 0) OR ([Resolved-Date/Time] is null)))

 

The chart should be like this \/

 Chart.jpg

 

 

Thank you very much!

 

 

1 ACCEPTED SOLUTION
v-qiuyu-msft
Community Support
Community Support

Hi @dcs136,

 

From your description, the logic is to count the incident which is opened in a specific week but isn't closed in this week, right?

 

If that is a case, you can create a measure like below:

 

Measure 2 = 
VAR m =
    CALCULATE ( MIN ( 'Date'[Date] ), ALLEXCEPT ( 'Date', 'Date'[WeekNum] ) )
VAR MX =
    CALCULATE ( MAX ( 'Date'[Date] ), ALLEXCEPT ( 'Date', 'Date'[WeekNum] ) )
RETURN
    CALCULATE (
        COUNTROWS ( Table3 ),
        FILTER (
            'Table3',
            AND (
                'Table3'[Submit Date] >= m
                    && Table3[Submit Date] <= MX,
                'Table3'[Resolved Date/Time] > MX
                    || Table3[Resolved Date/Time] = BLANK ()
            )
        )
    ) 

 

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-qiuyu-msft
Community Support
Community Support

Hi @dcs136,

 

From your description, the logic is to count the incident which is opened in a specific week but isn't closed in this week, right?

 

If that is a case, you can create a measure like below:

 

Measure 2 = 
VAR m =
    CALCULATE ( MIN ( 'Date'[Date] ), ALLEXCEPT ( 'Date', 'Date'[WeekNum] ) )
VAR MX =
    CALCULATE ( MAX ( 'Date'[Date] ), ALLEXCEPT ( 'Date', 'Date'[WeekNum] ) )
RETURN
    CALCULATE (
        COUNTROWS ( Table3 ),
        FILTER (
            'Table3',
            AND (
                'Table3'[Submit Date] >= m
                    && Table3[Submit Date] <= MX,
                'Table3'[Resolved Date/Time] > MX
                    || Table3[Resolved Date/Time] = BLANK ()
            )
        )
    ) 

 

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Join Arun Ulag at MPPC23

Join Arun Ulag at MPPC23

Get a sneak peek into this year's Power Platform Conference Keynote.

PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Top Solution Authors