0
0
Power BIbi_tool~10 mins

TOPN function in Power BI - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to return the top 5 products by sales amount.

Power BI
TopProducts = TOPN([1], Sales, Sales[Amount], DESC)
Drag options to blanks, or click blank then click option'
A5
B10
C3
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using 10 instead of 5 returns too many products.
Leaving the number blank causes an error.
2fill in blank
medium

Complete the code to return the top 3 customers by total sales.

Power BI
TopCustomers = TOPN([1], Customers, Customers[TotalSales], DESC)
Drag options to blanks, or click blank then click option'
A5
B1
C3
D7
Attempts:
3 left
💡 Hint
Common Mistakes
Using 1 returns only the top customer, not top three.
Using 5 or 7 returns more than needed.
3fill in blank
hard

Fix the error in the TOPN function to correctly return the top 4 products by quantity sold.

Power BI
TopProductsByQty = TOPN([1], Products, Products[Quantity], DESC)
Drag options to blanks, or click blank then click option'
AProducts
BQuantity
CSUM
D4
Attempts:
3 left
💡 Hint
Common Mistakes
Using a column name instead of a number causes an error.
Using an aggregation function like SUM in the first argument is incorrect.
4fill in blank
hard

Fill both blanks to return the top 3 salespersons by total sales amount in descending order.

Power BI
TopSalespersons = TOPN([1], Salespersons, Salespersons[[2]], DESC)
Drag options to blanks, or click blank then click option'
A3
BAmount
CTotalSales
DSales
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong column names causes errors.
Using a wrong number for top rows returns incorrect results.
5fill in blank
hard

Fill all three blanks to return the top 5 products by sales amount sorted in descending order.

Power BI
TopProducts = TOPN([1], Products, Products[[2]], [3])
Drag options to blanks, or click blank then click option'
A5
BAmount
CDESC
DASC
Attempts:
3 left
💡 Hint
Common Mistakes
Using ASC instead of DESC returns lowest values.
Using wrong column names causes errors.