March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi,
I have a calculated column in text type -
For example in the first dates in the image, the total hours is 169:11:52 it should be minus 1:01:55 which should give output around 168:09:57 approx. but due to a format issue, I am unable to get the result. Please review the file for more information - https://drive.google.com/file/d/1ua-mfEICRQDFBd7xkPMl_3H1lblT-c7Q/view?usp=drivesdk
Solved! Go to Solution.
Please find the file https://drive.google.com/file/d/1ua-mfEICRQDFBd7xkPMl_3H1lblT-c7Q/view?usp=drivesdk
thank you for your help.
Total Hours =
VAR h= ([DATE_CLOSED_UTC_SR]-[DATE_ENTERED_SR_EST])*24
var hr= ROUNDDOWN(h,0)
var m = (h-hr)*60
var mn = ROUNDDOWN(m,0)
var s= rounddown((m-mn)*60,0)
return format(hr,"00:") & format(mn,"00:") & format (s,"00")
Diff =
var t = SUBSTITUTE(SUBSTITUTE(SUBSTITUTE([AHT Text],"h","|"),"m","|"),"s","")
var d = if(PATHLENGTH(t)=3,value(pathitem(t,1)+DIVIDE(value(pathitem(t,2)),60)+DIVIDE(value(pathitem(t,3)),60*60),DIVIDE(value(pathitem(t,1)),60)+DIVIDE(value(pathitem(t,2)),60*60))
VAR h= ([DATE_CLOSED_UTC_SR]-[DATE_ENTERED_SR_EST])*24-d
var hr= ROUNDDOWN(h,0)
var m = (h-hr)*60
var mn = ROUNDDOWN(m,0)
var s= rounddown((m-mn)*60,0)
return format(hr,"00:") & format(mn,"00:") & format (s,"00")
I'm not sure that I fully understood what you need, but I created several calculated columns and one measure, I really hope this will help you
the logic is like this:
you need to convert everything into seconds, then calculate it and then convert it back to "hh:mm:ss"
you need to open it on another computer where the latest version of power bi should be
final =
VAR _Duration = SUM('support__cw_ops_manage_case_merge_temp'[Total Hoursxx])- SUM(support__cw_ops_manage_case_merge_temp[timtext_To_Time 2])
VAR _Hours = INT(_Duration/3600)
VAR Minutes =
INT ( MOD( _Duration - ( _Hours * 3600 ),3600 ) / 60)
VAR Seconds =
ROUNDUP(MOD ( MOD( _Duration - ( _Hours * 3600 ),3600 ), 60 ),0)
// These intermediate variables ensure that we have leading zero's concatenated onto single digits
// Hours with leading zeros
VAR H =
IF (ISBLANK(_Hours), "00",
IF( LEN ( _Hours ) = 1,
CONCATENATE ( "0", _Hours ),
CONCATENATE ( "", _Hours )
))
// Minutes with leading zeros
VAR M =
IF ( ISBLANK(Minutes), "00",
IF(LEN ( Minutes ) = 1,
CONCATENATE ( "0", Minutes ),
CONCATENATE ( "", Minutes )
))
// Seconds with leading zeros
VAR S =
IF ( ISBLANK(Seconds), "00",
IF( LEN ( Seconds ) = 1,
CONCATENATE ( "0", Seconds ),
CONCATENATE ( "", Seconds )
))
// Now return hours, minutes and seconds with leading zeros in the proper format "hh:mm:ss"
RETURN
CONCATENATE (
H,
CONCATENATE ( ":", CONCATENATE ( M, CONCATENATE ( ":", S ) ) )
)
Thi s is the latest version - Version: 2.123.742.0 64-bit (November 2023)
I have the same version and your sample file it is working perfectly but not working in my OG file
I don't know how to help you
Hi @Ahmedx I used your previously helped dax.
1. I created the below format
No worries, you have helped a lot. I will figure something out and will let you know how I was able to get it done. Give me some time.
Thank you so much for your help 😍
@Ahmedx As you can see the Final (Dax) that you helped with does not give the correct output it also it is in text format. Request you to please check the file one more time if possible, Please 🙂
This is great, to let you know what i want is the difference hours between FormattedAHT and Total Hours in hh:mm:ss format. The file you shared the dax does not work on my version of power BI - Version: 2.123.742.0 64-bit (November 2023)
@Ahmedx Please review the https://drive.google.com/file/d/1ua-mfEICRQDFBd7xkPMl_3H1lblT-c7Q/view?usp=drivesdk and help me out with yet another issue
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information or anything not related to the issue or question.
If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...
@lbendlin Please find the file https://drive.google.com/file/d/1ua-mfEICRQDFBd7xkPMl_3H1lblT-c7Q/view?usp=drivesdk please help out
Total Hours =
VAR h= ([DATE_CLOSED_UTC_SR]-[DATE_ENTERED_SR_EST])*24
var hr= ROUNDDOWN(h,0)
var m = (h-hr)*60
var mn = ROUNDDOWN(m,0)
var s= rounddown((m-mn)*60,0)
return format(hr,"00:") & format(mn,"00:") & format (s,"00")
Diff =
var t = SUBSTITUTE(SUBSTITUTE(SUBSTITUTE([AHT Text],"h","|"),"m","|"),"s","")
var d = if(PATHLENGTH(t)=3,value(pathitem(t,1)+DIVIDE(value(pathitem(t,2)),60)+DIVIDE(value(pathitem(t,3)),60*60),DIVIDE(value(pathitem(t,1)),60)+DIVIDE(value(pathitem(t,2)),60*60))
VAR h= ([DATE_CLOSED_UTC_SR]-[DATE_ENTERED_SR_EST])*24-d
var hr= ROUNDDOWN(h,0)
var m = (h-hr)*60
var mn = ROUNDDOWN(m,0)
var s= rounddown((m-mn)*60,0)
return format(hr,"00:") & format(mn,"00:") & format (s,"00")
That is a data quality issue. Your End date is before the Start date by two seconds.
Please find the file https://drive.google.com/file/d/1ua-mfEICRQDFBd7xkPMl_3H1lblT-c7Q/view?usp=drivesdk
thank you for your help.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
129 | |
90 | |
75 | |
58 | |
53 |
User | Count |
---|---|
200 | |
104 | |
101 | |
67 | |
55 |