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
Matic20
Frequent Visitor

Difference btn dates with many dependences

TimeTicket IdAgentState
1/1/2020 13:4826625Chris  Herbertcreated
1/2/2020 1:1326625Chris  Herbertpaused
1/2/2020 14:2326625Chris  Herbertresumed
1/2/2020 14:2526625Chris  Herbertclosed
1/2/2020 14:3026625Chris  Herbertreopened
1/2/2020 14:3226625Chris  Herbertclosed
1/1/2020 14:2226626Chris  Herbertcreated
1/2/2020 1:1326626Chris  Herbertpaused
1/2/2020 14:2326626Chris  Herbertresumed
1/2/2020 14:2526626Chris  Herbertclosed
1/2/2020 5:3926628Chris  Herbertcreated
1/2/2020 5:4126628Chris  Herbertpaused
1/3/2020 3:4926628Chris  Herbertresumed
1/3/2020 3:5526628Chris  Herbertclosed
1/2/2020 6:0826629Omar  Salamacreated
1/2/2020 6:2626629Omar  Salamapaused
1/2/2020 7:0626629Omar  Salamaresumed
1/2/2020 7:0726629Omar  Salamaclosed
1/2/2020 9:0726634Anmar  Raoufcreated
1/2/2020 9:0926634Anmar  Raoufpaused
1/2/2020 9:4726634Anmar  Raoufresumed
1/6/2020 8:4326634Anmar  Raoufclosed

 

Expected Result(Minutes)
Ticket ID Earliest Closed-Created_DateResumed- PausedLast Closed-ReopenedAchieved SLAAgent
2662514477552694Chris  Herbert
2662614437900653Chris  Herbert
266281336132808Chris  Herbert
266295940019Omar  Salama
2663457363805698Anmar  Raouf

 

Achieved SLA = (Earliest_Closed - DateCreated) - (ResumedDate - PausedDate) + (Last_ClosedDate - ReopenedDate)

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

SLA.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

13 REPLIES 13
Zas1442
Regular Visitor

image.jpg

 hi

Greg_Deckler
Super User
Super User

See my article on Mean Time Between Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/3395...


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

SLA.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

So far this what  i have 

Earliest_Closed_Created =
DATEDIFF(CALCULATE(MIN('Reports BI'[Time]),'Reports BI'[State] = "created"),CALCULATE(MIN('Reports BI'[Time]),'Reports BI'[State] = "closed"),MINUTE)
 
Resumed_Paused = DATEDIFF(CALCULATE(MIN('Reports BI'[Time]),'Reports BI'[State] = "paused"),CALCULATE(MIN('Reports BI'[Time]),'Reports BI'[State] = "resumed"),MINUTE)
 
LastClosed_Reopened = IF(
ISBLANK(
CALCULATE(
MIN('Reports BI'[Time]),'Reports BI'[State]="reopened")),
DATEDIFF(
CALCULATE(MIN('Reports BI'[Time]),'Reports BI'[State]="reopened"),
CALCULATE(MAX('Reports BI'[Time]),'Reports BI'[State]="closed"),MINUTE))
 
LastClosed_Reopened is returnining on;y blanks 
Earliest_Closed_Created and LastClosed_Reopened are so far returning the correct information 
 
 
 
Power bi.PNG
 
 
 
amitchandak
Super User
Super User

This will give diff between current and next step and then sum created, resume and reopened.

Create this as column

timediff = datediff(table[Time],minx(filter(table,table[Ticket Id] =earlier(table[Ticket Id] && table[Time] >earlier(table[Time])),table[Time]),day)

 

You can another column or measure an filter required steps

Appreciate your Kudos.

Still getting an error uisng earlier and including &&

 

Hello Ashish Mathur

 

Am trying your solution by the Last_Closed - Reopened Column is returning blanks only 

 

Thank you 

Hello Ashish Mathur

 

Last closed-reopened = IF(ISBLANK(CALCULATE(MIN('Reports BI'[Time]),'Reports BI'[State]="reopened")),0,1440*(CALCULATE(Max('Reports BI'[Time]),'Reports BI'[State]="Closed")-CALCULATE(MIN('Reports BI'[Time]),'Reports BI'[State]="reopened")))  // This worked and provided me with solution 
 
LastClosed_Reopened = IF(SBLANK(CALCULATE(MIN('Reports BI'[Time]),'Reports BI'[State]="reopened")),DATEDIFF(
CALCULATE(MIN('Reports BI'[Time]),'Reports BI'[State]="reopened"),CALCULATE(MAX('Reports BI'[Time]),'Reports BI'[State]="closed"),MINUTE)) // This is giving me blanks
 
I cant figure out the difference between 
 
And thank you, your solution provided me with the answer 
 

 

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi,

I can't say why.  It is working fine in the file i shared with you.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi,

I am not sure whom you are replying to but have you tried my solution?  I even share my solution file with you.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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.