Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Syntax
List.Count(list as list) as number
About
Returns the number of items in the specified list.
list: The list to examine.
Example 1
Find the number of values in the list {1, 2, 3}.
Usage
List.Count({1, 2, 3})
Output
3
Example 2
Find the number of times red appears in a list of colors, ignoring case.
Usage
let
colors = {"Red", "Blue", "GREEN", "red", "Yellow", "RED"},
redCount = List.Count(
List.Select(colors, each Text.Lower(_) = "red")
)
in
redCount
Output
3
Example 3
Find the number of customers in a list who purchased more than $100.
Usage
let
customers = {
[CustomerID = 101, CustomerName = "Alice", AmountPurchased = 150],
[CustomerID = 102, CustomerName = "Bob", AmountPurchased = 75],
[CustomerID = 103, CustomerName = "Carol", AmountPurchased = 50],
[CustomerID = 104, CustomerName = "Dave", AmountPurchased = 90],
[CustomerID = 105, CustomerName = "Eve", AmountPurchased = 120]
},
highValueCustomerCount = List.Count(
List.Select(customers, each [AmountPurchased] > 100)
)
in
highValueCustomerCount
Output
2