Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

How to create a table calculate OPEN CLOSED and ACTIVE AT END OF DAY Ticket count

Hi Friends,

 

I am pretty new to Power BI. I have a simple data with Ticket ID, CreatedDate, ClosedDate and Status.

I have to show the count of tickets created, closed and what was the total count of open tickets at the end of each day. Please help me to achieve this in Power BI.

 

DATA Looks like Below:

 

IDStatusCreatedDateClosedDate
A1Open15-Jul-20 
A2Closed15-Jul-2015-Jul-20
A3Closed15-Jul-2015-Jul-20
A4Closed15-Jul-2015-Jul-20
A5Closed15-Jul-2015-Jul-20
A6Closed15-Jul-2016-Jul-20
A7Closed16-Jul-2016-Jul-20
A8Closed16-Jul-2016-Jul-20
A9Closed16-Jul-2016-Jul-20
A10Closed16-Jul-2016-Jul-20
A11Closed16-Jul-2017-Jul-20
A12Closed16-Jul-2017-Jul-20
A13Open16-Jul-20 
A14Open16-Jul-20 
A15Open17-Jul-20 
A16Open17-Jul-20 
A17Open17-Jul-20 
A18Open17-Jul-20 
A19Open17-Jul-20 
A20Open17-Jul-20 

 

RESULT EXPECTED:

 

DateOpenedClosedActive at End of Day
15-Jul-20642
16-Jul-20855
17-Jul-20629
  • Anonymous's avatar
    Anonymous
    6 years ago

    Okay. Try this calculated table.

    TicketsCalculatedTable =
    VAR DateRange =
        CALENDAR ( MIN ( TicketsWithTeams[CreatedDate] ), TODAY () )
    VAR Teams =
        ALLNOBLANKROW ( TicketsWithTeams[Team] )
    VAR TC =
        CROSSJOIN ( DateRange, Teams )
    VAR Added_Opened =
        ADDCOLUMNS (
            TC,
            "Opened", COUNTROWS (
                FILTER (
                    ALLSELECTED ( TicketsWithTeams ),
                    TicketsWithTeams[CreatedDate] = [Date]
                        && TicketsWithTeams[Team] = EARLIER ( TicketsWithTeams[Team] )
                )
            ) + 0
        )
    VAR Added_Closed =
        ADDCOLUMNS (
            Added_Opened,
            "Closed", COUNTROWS (
                FILTER (
                    ALLSELECTED ( TicketsWithTeams ),
                    TicketsWithTeams[ClosedDate] = [Date]
                        && TicketsWithTeams[Team] = EARLIER ( TicketsWithTeams[Team] )
                )
            ) + 0
        )
    VAR Added_Active =
        ADDCOLUMNS (
            Added_Closed,
            "ActiveAtEndOfDay", COUNTROWS (
                FILTER (
                    ALLSELECTED ( TicketsWithTeams ),
                    TicketsWithTeams[CreatedDate] <= [Date]
                        && TicketsWithTeams[Team] = EARLIER ( TicketsWithTeams[Team] )
                        && ( TicketsWithTeams[Status] = "Open"
                        || TicketsWithTeams[ClosedDate] > [Date] )
                )
            ) + 0
        )
    RETURN
        Added_Active

     

14 Replies