Select the “Toolbox” tab at the bottom of the Information Model. Expand the “Functions” folder. Flow includes a number of built-in functions similar to what you would find in Excel. These functions can be used in the expressions of calculated measures.
In addition to the built-in functions, Flow allows you to create your own User Defined Functions. Right-click on “User Defined” and click “New”, “Function”. Name the new function “Efficiency”. Double-click on it to open its editor …
The function “Definition” is a standard Microsoft.NET C# static method. Don’t be scared of it, just type it out as shown above.
Click the “tick” button to validate the “Definition”. If there are any problems, Flow will provide an error message to explain what you have done wrong.
Using a Function in a Calculated Measure
Now that you have created your own User Defined Function for calculating Efficiency, let’s go back to the Calculated Measure you created for “Steam Production Efficiency (%)” and edit its calculation expression to rather use your new function.
Open the “Steam Production Efficiency (%)” measure and expand the “Retrieval” section. Undeploy the measure. Delete the expression. Drag the “Efficiency” function from the “Toolbox” into the expression editor.
Select the text “double Actual” and double-click the “Steam Production (tons/hr)”. Flow will replace the selected text with the measure’s name and value property. Do the same for the “double Rating” and validate your new expression.
Redeploy your Calculated Measure.