Forum Discussion
Chris12
8 years agoAdvocate I
User-defined functions in DAX?
Hi, this is a general question about the DAX language as I can use it in Power BI: Can I, as a user, define/create/reuse new functions in a Power BI report? I'm often in the situation that parts ...
Anonymous
5 years agoNot applicable
Just as a reference, if anyone searches for this problem and comes to this post as I did..
my way of simulating this kind of functions is creating DAX measures always using variables like that:
CustomColumn =
// define the parameters and where to get their values
var param_startdate = related('abc'[abc])
var param_enddate = 'xyz'[xyz]
// the actual function goes here
return datediff(param_startdate,param_enddate,MINUTE)
that way I created a little library for my own reference where I can quickly find such functions and can easily reuse them.
Chris12
5 years agoAdvocate I
Thanks. However, do I understand correctly that the reuse happens via copy & paste?
- Anonymous5 years agoNot applicable
Unfortunately yes, thats true. From a code maintenance perspektive that is a bad practise, I know. But its the only solution I can imagine for using standardized custom dax formulars with parameters.