cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bhmiller89 Member
Member

DateDiff Between Records by Person

I have a  Date/Time for each action a person takes, but there are multiple people each with their own actions. How would I find the datediff between each record by person/date? Columns: 


Date/Time | ActionType | AgentID (person) 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: DateDiff Between Records by Person

Hi @bhmiller89 ,

 

I created an sample as your requested, column date/time and clientID:

You can get the datediff using below measure: (you can change the datediff function as Second/Hour/Minute)

Measure = var a = CALCULATE(MIN([DateTime]),ALLEXCEPT('Table (2)','Table (2)'[ClientID]))
var b = CALCULATE(MAX([DateTime]),ALLEXCEPT('Table (2)','Table (2)'[ClientID]))
Return
DATEDIFF(a,b,DAY)

008.PNG

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

View solution in original post

4 REPLIES 4
Norrlands Frequent Visitor
Frequent Visitor

Re: DateDiff Between Records by Person

Hi!

 

Could you post two or three rows in your columns (with fake data) to clarify to problem a bit more? Not sure I quite understand your problem.

 

 

Highlighted
bhmiller89 Member
Member

Re: DateDiff Between Records by Person

Capture.JPG

Community Support Team
Community Support Team

Re: DateDiff Between Records by Person

Hi @bhmiller89 ,

 

Please correct me if I go wrong.

you'd like to calculate the datediff by same AgentID but different action, that it comparing the adjacent rows in date column. right?

It's preferred to share us your dummy pbix, that would be easier for us to provide the valuable advice.

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.
Community Support Team
Community Support Team

Re: DateDiff Between Records by Person

Hi @bhmiller89 ,

 

I created an sample as your requested, column date/time and clientID:

You can get the datediff using below measure: (you can change the datediff function as Second/Hour/Minute)

Measure = var a = CALCULATE(MIN([DateTime]),ALLEXCEPT('Table (2)','Table (2)'[ClientID]))
var b = CALCULATE(MAX([DateTime]),ALLEXCEPT('Table (2)','Table (2)'[ClientID]))
Return
DATEDIFF(a,b,DAY)

008.PNG

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

View solution in original post

Helpful resources

Announcements
Exclusive LIVE Community Event #3 – Ask Arun Anything

Exclusive LIVE Community Event #3 – Ask Arun Anything

Join us in the third Triple A event!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

January 2020 Community Highlights

January 2020 Community Highlights

Make sure you didn't miss any of the things that happened in the community in January!

Top Solution Authors