Custom functions
Custom functions play an important role in the M language. They allow you to consolidate your logic, making your code modular, reusable, and efficient. Think of a custom function as a tool designed for a specific task.
And while there are hundreds of standard library functions available, sometimes creating your own function is useful. They allow you to create solutions specific to your data challenges that consolidate multiple custom steps or address data transformation issues that built-in functions do not handle.
For instance, consider complex tasks like creating running totals, retrieving the previous row value, or computing an ISO week number. Manually writing the code for these transformations can be complicated and error-prone. Yet, by providing a custom function, you can now achieve the desired outcome with a reusable function call that you only need to set up once. Once created, these functions can easily be reused, making it easier for team members...