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
vissvess
Helper V
Helper V

Convert DAX to M Script

Hi,

 

I need to convert the below Calculated column (in Dax) to custom column (In M Query). Kindly help.

 

Duration = 
var __currentCreator = 'Build routing'[Creator]
var __currentRouting = 'Build routing'[Unit Status]
var __currentDate = 'Build routing'[Date]
var __currentTime = 'Build routing'[End Time]
var __previousTime =
    MAXX(
        FILTER(
            'Build routing',
            'Build routing'[Creator] = __currentCreator
            && 'Build routing'[Date] = __currentDate
            && 'Build routing'[Unit Status] = __currentRouting
            && 'Build routing'[End Time] < __currentTime
        ),
        'Build routing'[End Time]
    )
var __timeDiff = DATEDIFF(__previousTime, __currentTime, SECOND)
var __Duration = IF(__timeDiff>360,BLANK(),__timeDiff)
return
    __Duration

Thanks in advance.

0 REPLIES 0

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.