0
0
Power BIbi_tool~10 mins

TOPN function in Power BI - Cell-by-Cell Formula Trace

Choose your learning style9 modes available
Sample Data

This table shows products and their sales amounts.

CellValue
A1Product
B1Sales
A2Apple
B2150
A3Banana
B3120
A4Cherry
B4180
A5Date
B590
A6Elderberry
B6200
Formula Trace
TOPN(3, Table, Table[Sales], DESC)
Step 1: Table with columns Product and Sales
Step 2: Sort Table by Sales descending
Step 3: Take top 3 rows from sorted table
Cell Reference Map
    A        B
1 Product  Sales
2 Apple    150
3 Banana   120
4 Cherry   180
5 Date      90
6 Elderberry 200

Arrows:
Table[Sales] -> Used for sorting in TOPN
The formula uses the Sales column (B2:B6) to sort the table and pick the top 3 products.
Result
    A          B
1 Product    Sales
2 Elderberry 200
3 Cherry     180
4 Apple      150
The result shows the top 3 products with the highest sales values.
Sheet Trace Quiz - 3 Questions
Test your understanding
What does the TOPN function do in this example?
AReturns all products sorted alphabetically
BReturns the 3 products with the highest sales
CReturns the 3 products with the lowest sales
DReturns the total sales for all products
Key Result
TOPN(N, Table, Table[Column], DESC) returns top N rows sorted by Column descending