How to use FirstN(), LastN(), and Index() functions In Canvas Apps (Power Fx) on Power Platform

InogicDyn365CE2 years ago5 Views

Introduction

In today’s blog, we will explore how to implement FirstN(), LastN(), and Index() functions for filtering records of the Data Table in the Canvas App.
We had a client requirement where we needed to find out the top three highest Annual Revenue customers and bottom three lowest Annual Revenue customers for boosting their business.
To achieve the above requirement, we used Canvas App. Please find the below steps that we used to get the desired results:

Step 1:

We created a default Canvas App and in that, we added a DataTable. After creating the data table, we added the Client custom table in it which contains customer details such as Name, and Annual Revenue. As seen in the below screenshot. Also, we sorted the data in descending order based on annual revenue using the Sort function. Please find the below Power Fx formula that we used to sort the Data Table:

Sort(Clients, Revenue, Descending)

Power Fx

Power Fx

Step 2:
After sorting the data table by annual revenue, we performed the…


Source link

Leave a reply

Join Us
  • X Network2.1K
  • LinkedIn3.8k
  • Bluesky0.5K
Support The Site
Events
January 2025
MTWTFSS
   1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31   
« Dec   Feb »
Follow
Sign In/Sign Up Sidebar Search
Popular Now
Loading

Signing-in 3 seconds...

Signing-up 3 seconds...