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.
I am having trouble charting aging tickets over time. I can do it in Excel, but I cannot figure out how to do it in Power BI. Here is what the data look like:
I can create a table in Excel that calculates the age of each ticket, ticket average, then chart that data. Since Excel can use formulas as headers, I can drive the calculations off the table's headers.
I would rather not have to use Excel as an interum step and just import the raw data in the first table.
Is there a way to do that in Power BI?
Solved! Go to Solution.
I figured it out! Days was not returning partial days, so I had to use hours and divide by 1440.
Now the problem is the calculations are too hard for my computer's resources! Pardon the messy DAX.
Average Ticket Age = AVERAGEX('Incidents',
IF(
DATEDIFF('Incidents'[Submit Date],MAX(Dates[Date and Time]),MINUTE)<0, //Submit after reporting date is a neg #, so ticket is not open yet
"",
IF(
ISBLANK('Incidents'[Last Resolved Date]),//if the resoved date is blank, then it is max date minus submit date
DATEDIFF('Incidents'[Submit Date],MAX(Dates[Date and Time]),MINUTE)/1440,
IF(
'Incidents'[Last Resolved Date]>MAX(Dates[Date and Time]),
DATEDIFF('Incidents'[Submit Date],MAX(Dates[Date and Time]),MINUTE)/1440,
IF(
'Incidents'[Last Resolved Date]+1>MAX(Dates[Date and Time]),DATEDIFF('Incidents'[Submit Date],'Incidents'[Last Resolved Date],MINUTE)/1440,
""//If the resolved date is greater than the report date then the age is the report date minus submit date
)
)
)
))
Hi, @JimLee
It’s my pleasure to answer for you.
According to your description, I think modify the syntax in your measure .
Like this:
Open Incidents =
CALCULATE (
COUNTX (
FILTER (
'Incident Table',
'Incident Table'[Submit Date] <= MAX ( 'Dates'[Date] )
&& OR (
ISBLANK ( 'Incident Table'[Last Resolved Date] ),
'Incident Table'[Last Resolved Date] > MAX ( 'Dates'[Date] )
)
),
'Incident Table'[Incident Number]
),
CROSSFILTER ( 'Incident Table'[Submit Date], 'Dates'[Date], NONE )
)
If you have other questions, please feel free to ask me.
Best Regards
Janey Guo
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you for helping clean up my ticket count.
What I really need is to be able to track the ticket's age over time.
For example, in the data is INC000003301893 that was opened on Oct 3. I would like to be able to calculate is how old that ticket is on Oct 4, Oct 5, Oct 6, and so on. This will allow me to get the average ticket age for all open tickets during each period.
Is there a way to do that?
Hi, @JimLee
I don’t know why you use crossfilter, you can try this if it works:
Open Incidents =
CALCULATE (
COUNTX (
FILTER (
'Incident Table',
'Incident Table'[Submit Date] <= MAX ( 'Dates'[Date] )
&& 'Incident Table'[Submit Date] >= MIN ( 'Dates'[Date] )
&& OR (
ISBLANK ( 'Incident Table'[Last Resolved Date] ),
'Incident Table'[Last Resolved Date] > MAX ( 'Dates'[Date] )
)
),
'Incident Table'[Incident Number]
)
//,
// CROSSFILTER ( 'Incident Table'[Submit Date], 'Dates'[Date], NONE )
)
avg = DIVIDE([Open Incidents],DISTINCTCOUNT(Dates[Date]))
If the problem isn’t solved,please feel free to ask me.
Best Regards
Janey Guo
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for continuing to try and help.
The Open Incidents yielded zero results. I commented out this line and got the right counts:
&& 'MITSC RES - Last 6 Months Incid'[Submit Date] >= MIN ( 'Dates'[Date] )
Unfortunately, this gives the average count of tickets, but it does not work to get the average age of the tickets:
avg = DIVIDE([Open Incidents],DISTINCTCOUNT(Dates[Date]))
I need to be able to do something like a DATEDIFF using 'Dates'[Date] and [Submit Date], but I cannot figure out how to do that.
I figured it out! Days was not returning partial days, so I had to use hours and divide by 1440.
Now the problem is the calculations are too hard for my computer's resources! Pardon the messy DAX.
Average Ticket Age = AVERAGEX('Incidents',
IF(
DATEDIFF('Incidents'[Submit Date],MAX(Dates[Date and Time]),MINUTE)<0, //Submit after reporting date is a neg #, so ticket is not open yet
"",
IF(
ISBLANK('Incidents'[Last Resolved Date]),//if the resoved date is blank, then it is max date minus submit date
DATEDIFF('Incidents'[Submit Date],MAX(Dates[Date and Time]),MINUTE)/1440,
IF(
'Incidents'[Last Resolved Date]>MAX(Dates[Date and Time]),
DATEDIFF('Incidents'[Submit Date],MAX(Dates[Date and Time]),MINUTE)/1440,
IF(
'Incidents'[Last Resolved Date]+1>MAX(Dates[Date and Time]),DATEDIFF('Incidents'[Submit Date],'Incidents'[Last Resolved Date],MINUTE)/1440,
""//If the resolved date is greater than the report date then the age is the report date minus submit date
)
)
)
))
Hi,
Will the closed and open dates always be the first date of every month? Also, why do the dates in the header range stop till July 1?
Thank you for responding.
The dates are in mm/dd/yyyy format, so the open and closed dates in the example are throughout the month. I just created a quick table as an example of the data, but really there are thousands of tickets that span about two years.
Hi,
Well then take a realistic example and on that example show the exact result you are expecting.
If the data are easier to work with, then here they are.
@JimLee , Please refer my HR Blog that deals with this kind of data.
like :https://www.youtube.com/watch?v=e6Y-l_JtCq4&t=335s
Also in file attached after signature , I added some new calculations
Thank you for the post. I will have to review the data and DAX closer, but the example is calcuating the number of employees for each period. I am looking for the average tenure of all active employees for each period.
I can get the count of tickets by using:
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
100 | |
80 | |
64 | |
57 |
User | Count |
---|---|
145 | |
111 | |
92 | |
84 | |
66 |