Power Apps  

How to Use AddColumns() Function in Power Apps

Introduction

When building Power Apps, there are many scenarios where you need to display additional information without modifying your original data source. For example, you may want to calculate the total price of an order, display a customer's full name, or create a custom status based on business rules.

Instead of adding extra columns to your SharePoint list or Dataverse table, Power Apps provides the AddColumns() function, which lets you create calculated columns dynamically at runtime.

In this article, you'll learn how to use AddColumns() with practical examples, understand its benefits, and explore best practices for building efficient Power Apps.

What is AddColumns()?

The AddColumns() function creates a new table by adding one or more calculated columns to an existing table or collection. The new columns exist only while the app is running, so the original data source remains unchanged.

Syntax

AddColumns(
    Table,
    ColumnName,
    Formula
)

Parameters

ParameterDescription
TableThe table or collection to extend.
ColumnNameName of the new calculated column.
FormulaFormula used to calculate the value for each record.

Why Use AddColumns()?

Using AddColumns() offers several advantages:

  • Add calculated columns without changing your data source.

  • Simplify formulas in galleries and data tables.

  • Display dynamic business information.

  • Improve app readability and maintenance.

  • Create multiple calculated columns in a single function.

Sample Data

Assume we have an Orders SharePoint list.

OrderIDCustomerQuantityUnitPrice
1001Ketan2500
1002Vimal5250
1003Mitesh8150

Example 1: Calculate Total Price

Suppose you want to display the total amount for each order without creating a new SharePoint column.

AddColumns(
    Orders,
    TotalPrice,
    Quantity * UnitPrice
)

Output

CustomerQuantityUnitPriceTotalPrice
Ketan25001000
Vimal52501250
Mitesh81501200

Example 2: Create an Order Status

You can dynamically create a status column based on the order quantity.

AddColumns(
    Orders,
    OrderStatus,
    If(
        Quantity >= 5,
        "Bulk Order",
        "Regular Order"
    )
)

Output

CustomerQuantityOrderStatus
Ketan2Regular Order
Vimal5Bulk Order
Mitesh8Bulk Order

Example 3: Add Customer Category

Let's classify customers based on their purchase quantity.

AddColumns(
    Orders,
    CustomerCategory,
    If(
        Quantity >= 5,
        "Premium",
        "Standard"
    )
)

Output

CustomerCategory
KetanStandard
VimalPremium
MiteshPremium

Example 4: Add Multiple Columns

You can create more than one calculated column in a single function.

AddColumns(
    Orders,
    TotalPrice,
    Quantity * UnitPrice,
    Discount,
    Quantity * UnitPrice * 0.10,
    FinalPrice,
    Quantity * UnitPrice * 0.90
)

Output

CustomerTotalPriceDiscountFinalPrice
Ketan1000100900
Vimal12501251125
Mitesh12001201080

Using AddColumns() in a Gallery

Set the Items property of your Gallery.

AddColumns(
    Orders,
    TotalPrice,
    Quantity * UnitPrice
)

Now add a label inside the Gallery and set its Text property to:

ThisItem.TotalPrice

The gallery will automatically display the calculated value.

Combining AddColumns() with Filter()

Display only customers whose order quantity is 5 or greater.

AddColumns(
    Filter(
        Orders,
        Quantity >= 5
    ),
    TotalPrice,
    Quantity * UnitPrice
)

Output:

CustomerQuantityTotalPrice
Vimal51250
Mitesh81200
Add Column()

Real-World Use Cases

Invoice Processing

Calculate invoice line totals before submission.

Employee Directory

Display employee full names without storing another column.

Sales Dashboard

Calculate commissions, incentives, or bonuses dynamically.

Inventory Management

Calculate stock values using Quantity × Unit Cost.

Reporting

Create calculated KPIs for dashboards without modifying the data source.

Common Mistakes

  • Expecting AddColumns() to save values back to SharePoint.

  • Ignoring delegation warnings for large data sources.

  • Repeating the same calculation across multiple controls instead of using AddColumns() once.

Conclusion

The AddColumns() function is one of the most powerful Power Fx functions for shaping data in Power Apps. It allows you to add calculated columns dynamically, making your apps cleaner, more efficient, and easier to maintain. Whether you're calculating totals, assigning statuses, or preparing data for reports, AddColumns() helps you deliver a better user experience without modifying the underlying data source.

By combining AddColumns() with functions such as Filter(), Sort(), and Search(), you can build scalable and responsive applications while keeping your formulas simple and maintainable