Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello everyone,
I am new to Power BI. I am trying to calculate the time difference between two timestamps.
In Power Query my timestamp has the following format: 2025-05-13T13:48:28.4970000
When uploading my data to Power BI desktop the format of the timestamp is changing to 08.05.2025 13:48:28
Unfortnetly, I can not change the format with this in power bi
I need the information of the timestamp, because I am calculating the time difference between two timestamps as a new raw.
Solved! Go to Solution.
Hi @hish ,
can you try with below updated dax and let us know if you need anything else i think it will solve your issue
TimeDifferenceFormatted =
VAR CurrentTime = 'Machine Status Loops'[Zeitstempel]
VAR CurrentMachine = 'Machine Status Loops'[Maschine]
VAR NextTime =
CALCULATE (
MIN('Machine Status Loops'[Zeitstempel]),
FILTER (
'Machine Status Loops',
'Machine Status Loops'[Maschine] = CurrentMachine &&
'Machine Status Loops'[Zeitstempel] > CurrentTime
)
)
VAR Duration = NextTime - CurrentTime
VAR TotalMs = Duration * 86400000
VAR Seconds = INT(TotalMs / 1000)
VAR MilliSeconds = MOD(TotalMs, 1000)
RETURN
IF (
ISBLANK(NextTime),
BLANK(),
FORMAT(Seconds, "00") & "." & FORMAT(MilliSeconds, "000") & " sec"
)
Regards,
Chaithanya.
Hi @hish ,
As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.
Regards,
Chaithanya
Hi @hish ,
As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.
Regards,
Chaithanya
Hi @hish ,
As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.
Regards,
Chaithanya
Hi @hish ,
Thank you for reaching out to Microsoft Fabric Community Forum.
can you try with below dax and let us know if you need anything else i think it will solve your issue
Time Difference =
VAR CurrentTime = 'Machine Status Loops'[Zeitstempel]
VAR CurrentMachine = 'Machine Status Loops'[Maschine]
VAR NextTimestamp =
CALCULATE(
MIN('Machine Status Loops'[Timestamp]),
FILTER(
'Machine Status Loops',
'Machine Status Loops'[Maschine] = CurrentMachine &&
'Machine Status Loops'[Zeitstempel] > CurrentTime
)
)
VAR Duration = NextTimestamp - CurrentTime
RETURN
IF(
ISBLANK(NextTimestamp),
BLANK(),
FORMAT(Duration, "hh:mm:ss")
)
Regards,
Chaithanya
This code does still not show me the time differences in milisecounds
Hi @hish ,
can you try with below updated dax and let us know if you need anything else i think it will solve your issue
TimeDifferenceFormatted =
VAR CurrentTime = 'Machine Status Loops'[Zeitstempel]
VAR CurrentMachine = 'Machine Status Loops'[Maschine]
VAR NextTime =
CALCULATE (
MIN('Machine Status Loops'[Zeitstempel]),
FILTER (
'Machine Status Loops',
'Machine Status Loops'[Maschine] = CurrentMachine &&
'Machine Status Loops'[Zeitstempel] > CurrentTime
)
)
VAR Duration = NextTime - CurrentTime
VAR TotalMs = Duration * 86400000
VAR Seconds = INT(TotalMs / 1000)
VAR MilliSeconds = MOD(TotalMs, 1000)
RETURN
IF (
ISBLANK(NextTime),
BLANK(),
FORMAT(Seconds, "00") & "." & FORMAT(MilliSeconds, "000") & " sec"
)
Regards,
Chaithanya.
@hish , Try using
Zeitdifferenz =
VAR AktuellerZeitpunkt = 'Maschinenstatus Schleifen'[Zeitstempel]
VAR Maschine = 'Maschinenstatus Schleifen'[Maschine]
VAR VorherigerZeitpunkt =
CALCULATE(
MIN('Maschinenstatus Schleifen'[Zeitstempel]),
FILTER(
'Maschinenstatus Schleifen',
'Maschinenstatus Schleifen'[Maschine] = Maschine &&
'Maschinenstatus Schleifen'[Zeitstempel] > AktuellerZeitpunkt
)
)
VAR Dauer = VorherigerZeitpunkt - AktuellerZeitpunkt
RETURN
IF(
ISBLANK(VorherigerZeitpunkt),
BLANK(),
FORMAT(Dauer, "hh:mm:ss")
)
Proud to be a Super User! |
|
It is exactly my code with no changes. It is still not working
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 41 | |
| 39 | |
| 37 | |
| 29 | |
| 24 |
| User | Count |
|---|---|
| 118 | |
| 98 | |
| 70 | |
| 69 | |
| 65 |