Help with DAX Code

Hi All,

I want to calculate the percentage of tickets resolved within Service Level Agreement. I wrote the following DAX code:
resolved tickets within SLA =
VAR tickets = Count(tickets[ticketID])
VAR allgood = Calculate([resolution])
Return
Calculate(DIVIDE(allgood, tickets,0)

The result is in percentage. Is this code correct? or did I miss any step?

Thank you,
Chuk

Sorry the column [resolution] contains “False”. That is where the resolution is false.

Hi Chuk,

Why are you using variables here, are they necessary? Also, one thing I’ve found is that when I’m grabbing case data, sometimes, depending on the system I’m pulling from, there are multiple listings for ticketID, so I’d do it a little different based on the information you’ve given so far.

Measures:

Total Tickets = DISTINCTCOUNT(‘Tickets’[ticketID])
Within SLA = CALCULATE ( COUNT (‘Tickets’ [resolution]), ‘Tickets’ [resolution] = “True”)

SLA % = DIVIDE( Within SLA, Total Tickets, 0)

I hope this helps,

mickeydjw

1 Like

Hi @Chukliz, we’ve noticed that no response has been received from you since February 04, 2020. We just want to check if you still need further help with this post? In case there won’t be any activity on it in the next few days, we’ll be tagging this post as Solved. If you have a follow question or concern related to this topic, please remove the Solution tag first by clicking the three dots beside Reply and then untick the check box. Thanks!