PowerApps Sort & Filter A Data Table (When SQL Is Your Source)

I have rendered a SQL view in PowerApps in the form of a data table.  The table itself, is pretty simple – four columns and multiple rows.  The business problem I wanted to fix was as follows:

  1. I only want to show rows where a count of a field for a given row is equal to zero
  2. I want to filter the table using a toggle switch (the filter is on a “type” field that I have created)
  3. I want the entries to be displayed by the date field in descending order

The PowerApps code to achieve this is fairly simple, using the following.  Once you have added your toggle switch(es), you want to set the data table items property like this:

If(MyToggleSwitch.Value=true,Sort(Filter(MyViewOrTableName,Count=0,Type=”Blue”),Date,Descending))

Remember: you will need to change the names of the toggle switch, table/view and fields to match your naming convention)

When you Play the app and select the switch, it will show only the data that meets the criteria, in descending date order

You can add multiple If statements to this, but hopefully this is a simple example to get you started.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s