Power Fx in Power Automate brings the flexibility of Excel-style expressions to automation, making workflows more dynamic and efficient. With Power Fx functions, you can manipulate data, apply logic, and enhance automation without complex coding. This empowers users to build smarter flows with greater control over data processing and decision-making.

1. Power Fx Function setup

To create a Power Fx function for Power Automate, you first need to have a Solution in place. Within the solution, create a new component by navigating to Automation -> Function.

A form for creating the Power Fx function will appear, where you need to define:

  • Name and Description of the function

  • Input parameters – values that will be passed into the function

  • Output parameters – values that the function will return

Finally, you must define the Power Fx formula in the format:
{ OutputName: PowerFx function using Input parameters }

Power Fx RoundUp number function

With standard Power Automate functions, rounding a decimal number to a predefined number of decimal places was not easy. With a Power Fx function, it’s a breeze.

For inputs, we only need to collect:

  • The number of decimal places: DecimalPlaces

  • The original number: OriginalNumber

For the output, we only need to return RoundedNumber.

Formula: {RoundedNumber: RoundUp(OriginalNumber,DecimalPlaces)}

Power Fx Format number with Currency format function

Power Automate does not have a native function for formatting a number as currency. It can be easily suplemented by the Power Fx function.

Inputs:

  • OriginalNumber

  • CurrencyFormat (eg. #,#)

Outputs:

  • FormattedNumber

Formula: {FormattedNumber: Text(OriginalNumber, CurrencyFormat)}

Power Fx End of Month with specific Month offset function

Getting the last day of a month with a specific month offset is also not straightforward in Power Automate.

Inputs:

  • OriginalDate

  • MonthOffset (0 = current month)

Outputs:

  • EndOfMonth

Formula: {EndOfMonth: Text(EoMonth(OriginalDate,MonthOffset),”yyyy-MM-dd”)}

Power Fx Start of Month with specific Month offset function

Inputs:

  • OriginalDate

  • MonthOffset (0 = current month)

Outputs:

  • StartOfMonth

Formula: {StartOfMonth: Text(EoMonth(OriginalDate,MonthOffset-1)+1,”yyyy-MM-dd”)}

In conclusion, Power Fx functions in Power Automate bring greater flexibility and control to workflow automation. By leveraging custom functions, you can simplify complex calculations, format data efficiently, and enhance automation logic without relying on workarounds.

Mastering Power Fx opens up new possibilities for building smarter, more dynamic flows that improve efficiency and streamline business processes.

#8 Quick Win Power Fx Functions in Power Automate.pdf

#8 Quick Win Power Fx Functions in Power Automate.pdf

439.14 KBPDF File

Keep reading

No posts found