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

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

More About This Author

Inogic
Inogic is one of the leading Microsoft Dynamics 365 ISV since 10+ years. Its flagship product Maplytics™ is a market leading certified (CfMD) geo-analytical mapping app. Maplytics empowers Dynamics CRM users across industries with the power of geographical data visualization, route optimization and along the route search with turn-by-turn directions, appointment planner, locational search by radius and shapes with drill-down filters and color-coded pushpins, heat maps, shape layers & territory management.
 
Inogic is renowned for its high quality and low-cost offshore development services and productivity apps like InoLink: QuickBooks + Dynamics CRM, User Adoption Monitor, Attach2Dynamics, Alerts4Dynamics Click2Export, Click2Clone, Kanban Board, SharePoint Security Sync, Lead Automation & Distribution, Map My Relationships, Auto Tax Calculator, Subscription and Recurring Billing and Marketing4Dynamics.

Author: Inogic

Inogic is one of the leading Microsoft Dynamics 365 ISV since 10+ years. Its flagship product Maplytics™ is a market leading certified (CfMD) geo-analytical mapping app. Maplytics empowers Dynamics CRM users across industries with the power of geographical data visualization, route optimization and along the route search with turn-by-turn directions, appointment planner, locational search by radius and shapes with drill-down filters and color-coded pushpins, heat maps, shape layers & territory management.   Inogic is renowned for its high quality and low-cost offshore development services and productivity apps like InoLink: QuickBooks + Dynamics CRM, User Adoption Monitor, Attach2Dynamics, Alerts4Dynamics Click2Export, Click2Clone, Kanban Board, SharePoint Security Sync, Lead Automation & Distribution, Map My Relationships, Auto Tax Calculator, Subscription and Recurring Billing and Marketing4Dynamics.

Share This Post On
Share via
Copy link
Powered by Social Snap