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

Fabric Ideas just got better! New features, better search, and direct team engagement. Learn more

Custom (Reusable) DAX Function

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.
Status: Under Review
Comments
fbcideas_migusr
New Member

Feature: similar to Reporting Services, ability to save the function at the Company level, Report Level...

Example: for fiscal calendar, i could write a function Fiscal_SamePeriodLastYear(), and the whole company could use it.


A function could be:

  • independent of the Semantic model, in which case it may be easy to store at the company level or report level,

eg1: f(x) = x * x,

eg2: SamePeriodLastYear of a 4-4-5 calendar that can be computed based on math rules only

  • or dependent of the Semantic model, in which case it may be more difficult to make available at Company Level, eg: SamePeriodLastYear based on a Calendar that cannot be computed by math only as it needs a specific Calendar table

Report Level storage/availability would be a minimum.

Thanks

fbcideas_migusr
New Member
Status changed to: Under Review
 
grantmd
Regular Visitor
Why is this not a thing yet?