Omaer Khan on 01 Mar 2017 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)
RE: Custom (Reusable) DAX Function
This would be useful because I often need to do a linear interpolation in a measure with a What If Parameter, to shift between a min and max at a user-specified ratio. It's troublesome to repeat the linear interpolation formula and it would much easier if I could just create a Tween(min, max, ratio) function to leverage an abstract formula.
RE: Custom (Reusable) DAX Function
Would indeed be a big improvement for maintainbality and development time indeed. Im writing the same 2 formulas over and over, only difference are the ledger accounts that are being filtered.
RE: Custom (Reusable) DAX Function
It would be incredibly useful
RE: Custom (Reusable) DAX Function
Yes, please add to Power BI. This would end the long-winded DAX measures that are hard to read yet nonetheless critical for our company's reports.
Adding it to Excel's data model would be nice, too.
RE: Custom (Reusable) DAX Function
I agree wholeheartedly.
Why recreate the wheel every time you need one
RE: Custom (Reusable) DAX Function
Would be very useful and easier to do updates to a measurement (along with source control hopefully somewhere in the future)
RE: Custom (Reusable) DAX Function
Please update on this,
This will make power bi a power full tool.
need this ASAP
RE: Custom (Reusable) DAX Function
Any updates on this, Power BI Team? It's shocking that a product like this requires so much code duplication, it makes it so hard to maintain.
RE: Custom (Reusable) DAX Function
Yes to this. Huge issue on large models with many similar complex measures
RE: Custom (Reusable) DAX Function
100% keen for this. Also would appreciate having a built-in solution for working time, was surprised to find that you have to write that yourself