# SETVALUE

The SETVALUE formula can be used to assign a value to a data input field. It can be used to set up approval workflows in Power BI.

### Syntax

```javascript
SETVALUE(measure, value, row, column)
```

### Arguments

measure - The value will be assigned to the field specified in this parameter. Required.

value - The value to be assigned. Required.

row - Use the ROW identifier to reference the current row or pass the row category. Optional.

columns - Use the COLUMN identifier to reference the current column or pass the column category. Optional.

### Example

```
SETVALUE([Status], 'Approved')
//Assigns 'Approved' to the Status field

SETVALUE([Status], 'Approved', ROW.LEAVES, COLUMN.LEAVES)
//Assigns 'Approved' to the leaf rows and leaf columns
```

Data input dropdowns have an **On Change Formula** section where you can specify the actions to be triggered when a user selects an option. In this example, the ManagerApproval dropdown is set to 'Submitted' when the tax rate is changed:

<figure><img src="https://3062809325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEbkCXCUXmtUq5tcnUtZE%2Fuploads%2FY0yIb0meBWFzJmKN9ngu%2Fimage.png?alt=media&#x26;token=f800ce13-6bdc-4564-a87f-bbe0eca780fd" alt=""><figcaption><p>Setting the dropdown value when the data input is changed</p></figcaption></figure>

The ManagerApproval automatically changes to 'Submitted' when the TaxRate field is changed.

<figure><img src="https://3062809325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEbkCXCUXmtUq5tcnUtZE%2Fuploads%2FpAvb5y1olC4ltmTpT9T4%2FUntitled%20Project.gif?alt=media&#x26;token=0c4f9d42-a361-43a2-bafd-842d22d711ca" alt=""><figcaption><p>The approval dropdown is automatically updated when the data input field is changed.</p></figcaption></figure>

Similarly, we can set up approval workflows by changing the DirectorApproval to 'Pending' when the manager approves. If the change is rejected by the manager, the status is automatically set to 'Rejected' in the DirectorApproval dropdown.

<figure><img src="https://3062809325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEbkCXCUXmtUq5tcnUtZE%2Fuploads%2FnwF1sPT28QiLi6fYV6pr%2Fimage.png?alt=media&#x26;token=65416593-95ec-442d-8ebe-9ed96fbb6862" alt=""><figcaption><p>Using SETVALUE to create approval workflows</p></figcaption></figure>

The animation below shows a sample approval workflow:

<figure><img src="https://3062809325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEbkCXCUXmtUq5tcnUtZE%2Fuploads%2FKmNa8b26haRMeZ0ZWIpN%2FUntitled%20Project.gif?alt=media&#x26;token=5ac76d7f-526f-46b6-b276-ed1b41e5cf51" alt=""><figcaption><p>Approval workflow created using SETVALUE</p></figcaption></figure>
