DropColumns functions in Power Apps

The AddColumns, DropColumns, RenameColumns, and ShowColumns functions in Power Apps are used to shape the table by adding, dropping, renaming, and selecting its columns. All these functions, results in a new table, but note that the original table that is our data source is not modified at all by these functions.

DropColumns Function

The DropColumns function is used to remove columns from the table within Power Apps and returns the table with the rest columns. But it does not modify the original data source.

Power Apps Syntax DropColumns(Table, ColumnName1 [, ColumnName2, ... ] )
The function has the following parameters:

Power Apps Formula

ClearCollect(MyDropCollection, DropColumns('Teachers Data','Teacher salary', Expenditure))

The above formula will write the contents of the data source, 'Teachers Data', to the collection variable, MyDropCollection, after dropping the columns 'Teacher salary' and Expenditure.

DropColumns Function in Power Apps

The MyDropCollection is used in the Items property of the Gallery control, as shown in the image below:

DropColumns Function in Power Apps

In the above image we can see that the ‘Teacher salary’ and Savings fields are giving errors as both are not available in the table anymore. Because ‘Teacher salary’ is dropped by the DropColumns function and Savings column is functionally added to the collection, MyCollection, by using the AddColumns function, as it is not present in the original datasource.