Power Automate Div Function Explained

Power Automate Div Function

The Power Automate Div function, also known as integer division, divides the dividend by the divisor and returns the quotient as an integer.

It discards any remainder and rounds down to the nearest whole number. For example, div(7, 3) would return 2, and div(8, 3) would also return 2.

In this article, I’ll introduce you to the div function and will provide a step-by-step guide on how to use the function in a Microsoft flow.

Power Automate Div Function

power automate div expression
div expression in Power Automate

Divide two numbers and return the quotient. Use the mod() function to obtain the remainder.

Syntax

div(<dividend>, <divisor>)

Input parameters

  • dividend (mandatory): The number that will be divided by the divisor.
  • divisor (mandatory): The number that will divide the dividend, but must not be zero.

Return value

  • Returns the quotient of the first number divided by the second number, in floating-point if either the dividend or divisor is a float.

Power Automate Div Expression Example

div(9,3)
=> 3

div(8,3)
=> 2

// float example
div(5.5,1.5)
=> 3.6666666666666665

// with variable
div(variables(‘myNumber’), 3)

How To Use The Power Automate Div Function

Follow the steps to use the Power Automate Div function in a flow.

  1. Create a new flow with trigger ‘Manually trigger a flow’

    power automate div function new flow

    New flow

  2. Add a new step by clicking on ‘+ New step’

    power automate div function new step

    Add a new step

  3. Search for ‘initialize’ and click on ‘Initialize variable’

    power automate div function initialize variable

    Add Initialize variable action

  4. Setup Initialize variable: 1) Provide a name, 2) select type Integer, 3) Set value to ‘9’

    power automate div function setup initialiize variable

    Setup variable

  5. Add a compose step by searching for ‘compose’ and clicking on ‘Compose’

    power automate div function add compose

    Add Compose action

  6. Setup compose action: 1) click into Inputs (popup appears), 2) click on ‘Expressions’, 3) set expression to ‘div(variables(‘myNumber’), 3)’ 4) click on ‘OK’

    power automate div expression setup

    Setup div expression in Power Automate

  7. Save and do a test run

    power automate div function test run result

    Result test run – Power Automate Div function example

Leave a Comment

Your email address will not be published. Required fields are marked *