Forum Discussion
Time difference between date time values in same column based on a value in a different column
- 6 years ago
Hi Anonymous ,
Here is the pbix PBIX
I put both columns in so that you have your choice, the second column only shows in the last row of the user. The difference between the measure and the column at the high level, is that with a measure, the engine does not have row context, whereas in the table it does. (It knows which row it is operating on.) Therefore it was just a matter of dropping MAX().
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel
Hi Anonymous ,
Try it as a measure, not a calculated column. Looking at your first picture that is what i built it for. Put the first 5 columns on a table, then add the measure.
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel
Hi! Sorry for not specifying that i needed it as a calculated column, because I am doing some other calculations based on the elapsed time. When I return the past time, it is incorrectly returning the time per user. For example, for JF, it should return
9/30/2019 8:16:00 AM and for the MK it should return 10/1/2019 4:11:00 PM. I feel like if I could get this working, the rest of the function would be correct.
I appreciate the help!
- Nathaniel_C6 years agoCommunity Champion
Hi Anonymous ,
Here is the pbix PBIX
I put both columns in so that you have your choice, the second column only shows in the last row of the user. The difference between the measure and the column at the high level, is that with a measure, the engine does not have row context, whereas in the table it does. (It knows which row it is operating on.) Therefore it was just a matter of dropping MAX().
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel- Anonymous6 years agoNot applicable
Thanks so much for your help! This worked!
- Nathaniel_C6 years agoCommunity Champion
Hi Anonymous ,
You are welcome!
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel
- Anonymous6 years agoNot applicable
Nathaniel,
I have a similar problem. I have a restaurant reservations table. Basically there are just two columns that should go into calculation. PersonName and ReservationDate. I need to calculate the time difference between reservations of the same cusstomer. There may be customers who only reserved once so we don't count them. Only repeating customers count. They may have from two records to many. How can I do that in DAX?
Thansk,
Stan