You cannot create functions in DAX, and this is a limitation to certain abstractions you might want to implement for complex models.
I used a pattern that allows you to "pass an parameter" to a DAX measure, simulating the behavior of a function at least in certain conditions and with many limitations. In practice, you can write:
[Discounted Amount] ( Par1[Value] = 0.20, Par2[Value] = 0 )
Well I really don't like this syntax, in fact DAX Formatter translates it into:
CALCULATE (
[Discounted Amount],
Par1[Value] = 0.20,
Par2[Value] = 0.00
)
If at this point the trick does not seem pretty obvious... read the full article Parameters in DAX Measures on SQLBI!