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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
DazzaG
New Member

assistance with DAX code please

hi team, im fairly new to power BI and am helping my colleague with some reporting.  We are using a report created by someone else who has since left the organisation. The  report displays some averages using DAX query but the results appear to be very generous or low. I believe that something in the DAX formular or the way the data is displayed isnt right and would appreciate some assistance trying to work through it.

 

One example is Average Manger approval time which the result is 00:01:49 . Looking at the data [Manager Approval] it should be alot highter. A snippet of the [Manager Approval] data is below. Thats not all the data just a sample

 

DazzaG_0-1691529170441.png

 

 the DAX query is 

 

Avg Manager Approval Time =

VAR DecimalMinutes = AVERAGE(TimeIntelligence[Manager Approval])

VAR Duration = DecimalMinutes * 60

VAR Hours = INT(DIVIDE(Duration,3600,0))

VAR Minutes = INT(DIVIDE(MOD( Duration - ( Hours * 3600 ),3600),60,0))

VAR Seconds = ROUNDUP(MOD ( MOD( Duration - ( Hours * 3600 ),3600 ), 60 ),0)

VAR H = IF (LEN ( Hours ) = 1, CONCATENATE ( "0", Hours ), CONCATENATE ( "", Hours ))

VAR M = IF (LEN ( Minutes ) = 1, CONCATENATE ( "0", Minutes ), CONCATENATE ( "", Minutes ))

VAR S = IF (LEN ( Seconds ) = 1, CONCATENATE ( "0", Seconds ), CONCATENATE ( "", Seconds ))

RETURN

IFERROR(
    IF (DecimalMinutes>0,
    H & ":" & M & ":" & S,
    "0:00"),
    "Error")

 

thanks in advance

1 REPLY 1
ToddChitt
Super User
Super User

This is the Power Query forum. You may find better luck in the Desktop forum. But since you're here:

Can you convert the time interval to a base of seconds or minutes, (i.e.: some common integer value) then calculate a simple AVERAGE DAX Measure from that and compare the two? For example, if the existing report shows a single Manager's Average Time as 00:01:49 (DD:HH:MM ?) and your simple DAX Average is 109 minutes, then you know it is right.




Did I answer your question? If so, mark my post as a solution. Also consider helping someone else in the forums!

Proud to be a Super User!





Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.