Calculating averages in dataview

Hello everyone,
I am having a hard time understanding how averages are done in dataview. I have looked at some posts in the forum but I can’t understand how they work.

I have an existing and working query that gets me the total MTTC of my tickets.

WHERE contains(,"INC") OR contains(,"SCTASK") AND !contains(Closed, null) AND !contains(Created, null)
FLATTEN (Closed - Created).days AS MTTC
FLATTEN length(rows.MTTC) as MTTC

What I need is to get the weekly average MTTC. Can someone help?

What is the MTTC ? You’re defining it twice with two different values:

  • Once as kind of a duration doing the `(Closed - Created).days as MTTC
  • Once as length(rows.MTTC) as MTTC

Which would you like the average of?

MTTC is the difference between the closed and the created date. What I want is the average MTTC for each week.

To get a weekly average you need to connect your MTTC to a week number, and then group in that week number. Then you can do an average(rows.MTTC).

So get your query to report back the week number and the MTTC column for starters. Then you add the group by statement and replace the columns with the average statement.

Can you help me with the code itself?

I’ve given you the tools you need, and I don’t have the details of your setup (or intentions), so “No, I can’t write the code for you.”

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.