Mastering Take Function in Power Automate

Introduction to Take Function in Power Automate

Power Automate offers a wide range of expression functions that help automate data processing and workflow logic. One of the most useful functions for handling arrays and collections is the Take() function.

What is the Take Function?

The Take() function returns the first specified number of elements from an array or collection.

Syntax: take(array, count)

Where: array = Source array or collection, count = Number of items to retrieve

Example: take(createArray('A', 'B', 'C', 'D', 'E'), 3)

Output: ['A', 'B', 'C']

Why Use the Take Function?

The Take Function in Power Automate is useful when you need to process only the first few records, limit API response data, build dashboard summaries, generate concise reports, test workflows with sample data, or improve overall flow performance.

Solution Overview

A typical workflow involves getting data, creating an array, applying the Take() function, and returning the first N records.

Step-by-Step Guide

Step 1: Create a Flow

Create a new Power Automate flow and select the trigger that best fits your business scenario.

Step 2: Initialize an Array

Example array: ['Apple', 'Orange', 'Banana', 'Mango', 'Grapes']

Step 3: Use the Take Function

Add a Compose action and enter the following expression: take(variables('FruitArray'), 3)

Result: ['Apple', 'Orange', 'Banana']

Working with SharePoint Data

Suppose a SharePoint list contains 500 records, but you only need the first 10. Use the following expression: take(body('Get_items')?['value'], 10)

Result: Only the first 10 SharePoint records are processed.

Working with Dataverse Records

Retrieve records using the List Rows action, and then apply: take(outputs('List_rows')?['body/value'], 5)

Result: Only the first five Dataverse records are returned.

Real-World Example

Display Top 5 Open Cases

Requirement: Display the first five open cases from Dataverse and send them in an email report.

Workflow: List Rows → Apply Take(5) → Create HTML Table → Send Email Report

Result: Users receive a concise report containing only the most relevant open cases.

Common Use Cases

Take vs First Function

Both functions retrieve data from arrays, but they serve different purposes.

First() returns a single record.

Take() returns multiple records.

Best Practices

Benefits of Using Take Function in Power Automate