Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hello,
I've been stuck on this issue. So basically the challenge that I have is, I have a column of Timestamp and I want to know the gap in betweem the timestamp and the next time stamp (see table below).
To make it more clear, the goal is to subtract A3 to A2 and thats the results on C2 and so forth. Ive done this in excel I wonder how to do this on PowerBI DAX. Need help on this thanks!
| A | B | C | ||
| 1 | TimeStamp | Hour | Results | |
| 2 | 1/18/20 6:16 | 6 | 0:01:02 | |
| 3 | 1/18/20 6:17 | 6 | 0:42:30 | |
| 4 | 1/18/20 7:00 | 7 | 0:00:01 | |
| 5 | 1/18/20 7:00 | 7 | 0:00:55 | |
| 6 | 1/18/20 7:01 | 7 | 0:00:44 | |
| 7 | 1/18/20 7:01 | 7 | 0:00:10 | |
| 8 | 1/18/20 7:02 | 7 | 0:58:05 | |
| 9 | 1/18/20 8:00 | 8 | 0:00:34 | |
| 10 | 1/18/20 8:00 | 8 | 0:00:29 | |
| 11 | 1/18/20 8:01 | 8 | 0:00:40 | |
| 12 | 1/18/20 8:01 | 8 | 0:00:29 | |
| 13 | 1/18/20 8:02 | 8 | 0:00:06 | |
| 14 | 1/18/20 8:02 | 8 | 0:58:03 | |
| 15 | 1/18/20 9:00 | 9 | 0:00:07 | |
| 16 | 1/18/20 9:00 | 9 | #REF! | <-- error need iferror |
Solved! Go to Solution.
Not exact, but try.
diff =
datediff(table[Fecha del evento],max(filter(table,table[hour] =earlier(table[hour]) && table[TimeStamp] < earlier(table[TimeStamp])
&& table[Evento] = "BAJA-DEFINITIVA"),table[TimeStamp]),MINUTE)
OR
diff =
datediff(table[Fecha del evento],max(filter(table,table[hour] =earlier(table[hour]) && table[ID] < earlier(table[ID]-1)
&& table[Evento] = "BAJA-DEFINITIVA"),table[TimeStamp]),MINUTE)
Change as per need
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges
Connect on Linkedin
Not exact, but try.
diff =
datediff(table[Fecha del evento],max(filter(table,table[hour] =earlier(table[hour]) && table[TimeStamp] < earlier(table[TimeStamp])
&& table[Evento] = "BAJA-DEFINITIVA"),table[TimeStamp]),MINUTE)
OR
diff =
datediff(table[Fecha del evento],max(filter(table,table[hour] =earlier(table[hour]) && table[ID] < earlier(table[ID]-1)
&& table[Evento] = "BAJA-DEFINITIVA"),table[TimeStamp]),MINUTE)
Change as per need
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges
Connect on Linkedin
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 53 | |
| 45 | |
| 44 | |
| 20 | |
| 19 |
| User | Count |
|---|---|
| 73 | |
| 71 | |
| 34 | |
| 33 | |
| 31 |