Skip to main content

Power BI

Under Review

Custom (Reusable) DAX Function

Vote (718) Share
Omaer Khan's profile image

Omaer Khan on 2017-03-01 02:06:50

I'd like to be able to create reusable functions in DAX, instead of using the same DAX code in multiple measures.

Example: I have some complicated DAX code, which calculates the no of working seconds between two date-times. This excludes holidays, weekends, and only counts seconds from the start of the work-day, to the end of the work-day.

I use this DAX code a lot, for many measures which need to be in "Working Time" (working hours/minutes).

I would love to not have to copy-paste a bunch of code into all of my measures, but to be able to create a reusable function instead.

Comments (59) Merged Idea (1)
Vote 10
's profile image

on 2017-09-27 15:29:53

Power BI

Custom DAX Functions with Variables

Would be useful if you had the ability to create your own DAX functions that allows for variables to be inserted into the function. I find that quite often I require a Base Measure that only subtly needs changing. Eg, Groups by a different dimension in a SUMMARIZE formula, or alternately uses a ...

Merged