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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
_n_MarianLein
Helper II
Helper II

Otobo ticket report - Backlog per date

Hi all,
I'm working on an internal ticket report that should show the open tickets per date.
In my source material I have the following relevant parameters:

  • ticket ID - distinct ticket ID
  • date_created - date field showing creation of the ticket
  • date_changed - date field showing last change to the ticket. may be identical with "date_created"
  • state - open, pending, closed successful, closed unsuccessful, merged

There is no field specifically for "date_closed". What I have:

 

TicketCountPerDayAndStatus = 
ADDCOLUMNS (
    CALENDARAUTO (),
    "Opened on date", CALCULATE (
        DISTINCTCOUNT ( 'Otobo Tickets'[id] ),
        FILTER (
            'Otobo Tickets',
            'Otobo Tickets'[date_created] = [Date] &&
            'Otobo Tickets'[Queue Name] <> "specific_queue"
        )
    ),
    "Closed on date", CALCULATE (
        DISTINCTCOUNT ( 'Otobo Tickets'[id] ),
        FILTER (
            'Otobo Tickets',
            'Otobo Tickets'[date_changed] = [Date] &&
            'Otobo Tickets'[Queue Name] <> "specific_queue" && (
                'Otobo Tickets'[State] = "closed successful" ||
                'Otobo Tickets'[State] = "closed unsuccessful" ||
                'Otobo Tickets'[State] = "merged"
            )
        )
    )
)

 

Which gives me this table:

_n_MarianLein_0-1644567120100.png

 

Now, I want to have a caluclated sum that is showing me all tickets that are open at this date, to show a general trend / backlog in tickets.

So IMHO I would need to sum up all tickets that have been opened until or at the specific date minus all tickets that have been closed until the specific date.

 

I just can't wrap my head around this, and I feel like I'm wasting my time trying to create this by "distinctcount(something)". There's got to be an easier way than this!?

And yes, I have already searched this forum and tried the solutions pointed out here and here, but they don't work for me, as they are not really applicable to my situation.

1 ACCEPTED SOLUTION
_n_MarianLein
Helper II
Helper II

Hi all,
I managed to solve the issue with a dedicated table and columns per date. My final (working) code is:

TicketCountPerDay = 
ADDCOLUMNS (
    Calendarauto(),
    "Opened on date", CALCULATE (
        DISTINCTCOUNT ( 'Otobo Tickets'[id] ),
        FILTER (
            'Otobo Tickets',
            'Otobo Tickets'[date_created] = [Date] &&
            'Otobo Tickets'[Queue Name] <> "specific_queue"
        )
    ),
    "Closed on date", CALCULATE (
        DISTINCTCOUNT ( 'Otobo Tickets'[id] ),
        FILTER (
            'Otobo Tickets',
            'Otobo Tickets'[date_changed] = [Date] &&
            'Otobo Tickets'[Queue Name] <> "specific_queue" && 
            (
                'Otobo Tickets'[State] = "closed successful" ||
                'Otobo Tickets'[State] = "closed unsuccessful" ||
                'Otobo Tickets'[State] = "merged"
            )
        )
    ),
    "Open on date", CALCULATE(
        DISTINCTCOUNT( 'Otobo Tickets'[id] ),
        Filter (
            'Otobo Tickets',
            'Otobo Tickets'[Queue Name] <> "specific_queue" &&
            (
                'Otobo Tickets'[date_created] <= [Date] &&
                'Otobo Tickets'[State] <> "closed successful" &&
                'Otobo Tickets'[State] <> "closed unsuccessful" &&
                'Otobo Tickets'[State] <> "merged"
            ) || (
                'Otobo Tickets'[date_created] <= [Date] && (
                    'Otobo Tickets'[State] = "closed successful" ||
                    'Otobo Tickets'[State] = "closed unsuccessful" ||
                    'Otobo Tickets'[State] = "merged"
                ) &&
                'Otobo Tickets'[date_changed] > [Date]
            )
        )
    )
)

 

View solution in original post

8 REPLIES 8
_n_MarianLein
Helper II
Helper II

Hi all,
I managed to solve the issue with a dedicated table and columns per date. My final (working) code is:

TicketCountPerDay = 
ADDCOLUMNS (
    Calendarauto(),
    "Opened on date", CALCULATE (
        DISTINCTCOUNT ( 'Otobo Tickets'[id] ),
        FILTER (
            'Otobo Tickets',
            'Otobo Tickets'[date_created] = [Date] &&
            'Otobo Tickets'[Queue Name] <> "specific_queue"
        )
    ),
    "Closed on date", CALCULATE (
        DISTINCTCOUNT ( 'Otobo Tickets'[id] ),
        FILTER (
            'Otobo Tickets',
            'Otobo Tickets'[date_changed] = [Date] &&
            'Otobo Tickets'[Queue Name] <> "specific_queue" && 
            (
                'Otobo Tickets'[State] = "closed successful" ||
                'Otobo Tickets'[State] = "closed unsuccessful" ||
                'Otobo Tickets'[State] = "merged"
            )
        )
    ),
    "Open on date", CALCULATE(
        DISTINCTCOUNT( 'Otobo Tickets'[id] ),
        Filter (
            'Otobo Tickets',
            'Otobo Tickets'[Queue Name] <> "specific_queue" &&
            (
                'Otobo Tickets'[date_created] <= [Date] &&
                'Otobo Tickets'[State] <> "closed successful" &&
                'Otobo Tickets'[State] <> "closed unsuccessful" &&
                'Otobo Tickets'[State] <> "merged"
            ) || (
                'Otobo Tickets'[date_created] <= [Date] && (
                    'Otobo Tickets'[State] = "closed successful" ||
                    'Otobo Tickets'[State] = "closed unsuccessful" ||
                    'Otobo Tickets'[State] = "merged"
                ) &&
                'Otobo Tickets'[date_changed] > [Date]
            )
        )
    )
)

 

AllisonKennedy
Super User
Super User

@_n_MarianLein  You don't need to create a new table, just a new measure, then add to Table visual in the report. You have done number of tickets opened already, just need to tweak it to work as a measure:

 

 Count Tickets Opened =  CALCULATE (
        DISTINCTCOUNT ( 'Otobo Tickets'[id] ),
        FILTER (
            'Otobo Tickets',
            'Otobo Tickets'[date_created] = SELECTEDVALUE(DimDate[Date]) &&
            'Otobo Tickets'[Queue Name] <> "specific_queue"
        )
)
    

Now you just need to change the

= SELECTEDVALUE( DimDate[Date] )

to a 

<= SELECTEDVALUE( DimDate[Date] )

to get the cumulative count.

 

You can do the same thing for closed tickets, then subtract the two measures. 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Unfortunately, when trying to create a new measure, SELECTEDVALUE([Date]) does not work - It's showing an error "the column 'date' was not found or must not be used in this statement"...

@_n_MarianLein  do you have a DimDate table? You'll need that: https://excelwithallison.blogspot.com/2020/04/dimdate-what-why-and-how.html

 

Then you can try my previous suggestion. 

 

 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

OK, creating the DimDate table worked so far, so I now have the count of tickets opened on a specific date.
Additionally, I can get the count of tickets closed on a specific date.

 

Now, how can I correlate these two measures, showing me the open tickets per date?

amitchandak
Super User
Super User

Hi,
Attached is some sample data from the ticket system...

The values I expect are:

DateOpened on dateClosed on dateCumulative Open on date<explanation>
2022-01-012 2opened today
2022-01-021 3open yesterday + opened today - closed yesterday
2022-01-0316819
2022-01-0481019
2022-01-056515
2022-01-06  10
2022-01-079719

...

 

Sample data:

idstatequeuedate_createddate_changed
12855closed successfulotherQueueName2022-01-012022-01-03
12856mergedotherQueueName2022-01-012022-01-03
12857closed successfulotherQueueName2022-01-022022-01-04
12858closed successfulotherQueueName2022-01-032022-01-04
12859closed successfulotherQueueName2022-01-032022-01-04
12860closed successfulspecific_queue2022-01-032022-02-04
12861closed successfulotherQueueName2022-01-032022-01-04
12862closed successfulotherQueueName2022-01-032022-01-03
12863closed successfulotherQueueName2022-01-032022-01-03
12864closed successfulotherQueueName2022-01-032022-01-03
12865closed successfulotherQueueName2022-01-032022-01-04
12866closed successfulotherQueueName2022-01-032022-01-03
12867closed successfulotherQueueName2022-01-032022-01-03
12868closed successfulotherQueueName2022-01-032022-01-20
12869closed successfulotherQueueName2022-01-032022-01-03
12870closed successfulotherQueueName2022-01-032022-02-04
12871closed successfulotherQueueName2022-01-032022-01-21
12872closed successfulotherQueueName2022-01-032022-01-04
12873closed successfulotherQueueName2022-01-032022-01-10
12874closed successfulotherQueueName2022-01-042022-01-04
12875closed successfulotherQueueName2022-01-042022-01-04
12876closed successfulotherQueueName2022-01-042022-01-13
12877mergedotherQueueName2022-01-042022-01-04
12878closed successfulotherQueueName2022-01-042022-01-04
12879closed successfulotherQueueName2022-01-042022-01-07
12880closed successfulotherQueueName2022-01-042022-01-05
12881closed successfulotherQueueName2022-01-042022-01-05
12882closed successfulotherQueueName2022-01-052022-01-05
12883closed successfulotherQueueName2022-01-052022-01-07
12884closed successfulotherQueueName2022-01-052022-01-14
12885closed successfulotherQueueName2022-01-052022-02-03
12886closed successfulotherQueueName2022-01-052022-01-05
12887closed successfulotherQueueName2022-01-052022-01-05
12888closed successfulotherQueueName2022-01-072022-01-07
12889mergedotherQueueName2022-01-072022-01-07
12890mergedotherQueueName2022-01-072022-01-07
12891mergedotherQueueName2022-01-072022-01-07
12892closed successfulotherQueueName2022-01-072022-01-07
12893closed successfulotherQueueName2022-01-072022-01-17
12894closed successfulotherQueueName2022-01-072022-01-12
12895closed successfulotherQueueName2022-01-072022-01-28
12896closed successfulotherQueueName2022-01-072022-01-10
12897closed successfulotherQueueName2022-01-082022-01-10
12898closed successfulotherQueueName2022-01-092022-01-10

@amitm - Have you had a chance to look at this?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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