Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
ERing
Helper V
Helper V

Is it possible to dynamically time duration in minutes if greater than 60 seconds?

I have a requirement to display web site visit duration. What I'm struggling with is how I can show the result so that if  Average_Visit_Time <=60 seconds then show "00 SEC" but if Average_Visit_Time is >=61 seconds then show "00:00 MIN:SEC".

My measure and samle data is below.

 

Average_Visit_Time = AVERAGE(TABLE [VISIT_DURATION_SECONDS])
 
Visit_IDVisit_DateVISIT_DURATION_SECONDS
110/2/221130
210/1/221453
310/2/22433
410/4/22434
510/3/221130
610/3/221397
710/3/22107
810/2/221054
910/5/221388
1010/1/22250
1110/5/22748
1210/4/221213
1310/1/221417
1410/3/221441
1510/4/22650
1610/1/221106
1710/1/22750
1810/4/221470
1910/3/22565
2010/1/221144
2110/3/221239
2210/3/22430
2310/2/221435
2410/5/221400
2510/1/22557
2610/3/22955
2710/4/22632
2810/4/22419
2910/4/22732
3010/5/2251
1 ACCEPTED SOLUTION
vicky_
Super User
Super User

Here's something to get you started: 

Measure = 
var TotalSeconds = AVERAGE('Table'[VISIT_DURATION_SECONDS])
var TotalMins = QUOTIENT(TotalSeconds, 60)
var remainderSeconds = MOD(TotalSeconds, 60)
return IF(TotalSeconds > 60, FORMAT(TotalMins, "##########") & ":" & FORMAT(remainderSeconds, "00"), TotalSeconds & " seconds")

View solution in original post

1 REPLY 1
vicky_
Super User
Super User

Here's something to get you started: 

Measure = 
var TotalSeconds = AVERAGE('Table'[VISIT_DURATION_SECONDS])
var TotalMins = QUOTIENT(TotalSeconds, 60)
var remainderSeconds = MOD(TotalSeconds, 60)
return IF(TotalSeconds > 60, FORMAT(TotalMins, "##########") & ":" & FORMAT(remainderSeconds, "00"), TotalSeconds & " seconds")

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.