Power Query List.AnyTrue: Step-by-Step Guide
In this article
List.AnyTrue in Power Query returns true if at least one item in a list is true, and false otherwise. It is the fastest way to test a whole column of yes/no values without writing a custom function. The function is native to Power Query M and works the same in Excel, Power BI, and Power Query Online. You need a query that already contains a list, or a step that produces one, and you should understand that List.AnyTrue only evaluates logical (true/false) values — it does not coerce text like "yes" or numbers like 1 automatically.
What You'll Need
- Power Query available in Excel (Data > Get & Transform Data), Power BI Desktop (Transform Data), or Power Query Online. Menu labels can differ slightly by version, device, or region.
- A query with a list of logical values, or a column you can convert to logical type.
- Basic familiarity with the Power Query Editor and the formula bar.
Step-by-Step
- Open the Power Query Editor. In Excel, go to Data > Get & Transform Data > Launch Power Query Editor. In Power BI Desktop, click Transform Data on the Home ribbon.
- Load or create the data you want to test. For a quick test, go to Home > Enter Data and type a small table with one column of true/false values, then click OK.
- Make sure the column is logical type. Select the column header, then on the Home tab open the Data Type dropdown and choose True/False. If the column contains text such as "Yes" or "No", first use Transform > Replace Values to convert them, or add a conditional column that outputs logical values.
- Turn the column into a list. With the column selected, go to Transform > To List (in some versions it appears under the Transform tab as Convert to List). The step in the formula bar will look like
Table.Column(#"Previous Step", "ColumnName"). - Wrap the list step with List.AnyTrue. Click the formula bar, place your cursor before the existing expression, type
List.AnyTrue(, then move to the end and close the parenthesis. For example:List.AnyTrue(Table.Column(#"Changed Type", "Approved")). Press Enter. - Check the result. The step now returns a single logical value — true if any item is true, false if every item is false or the list is empty.
- Use the result. If you need it as a query output, rename the step and close & load. If you need it inside a larger expression, reference the step name in a later step, for example in an if statement:
if List.AnyTrue(MyListStep) then "Action needed" else "All clear".
Common Mistakes
- Passing a table instead of a list. List.AnyTrue expects a list. If you pass a table column directly without converting, you get an error about the argument type. Use Table.Column or the To List button first.
- Leaving the column as text. Values like "true" or "TRUE" stored as text are not logical true. List.AnyTrue will error or return unexpected results. Convert the data type first.
- Forgetting that an empty list returns false. If the list has no items, List.AnyTrue returns false, which can look like a bug when the source data is simply empty.
- Using it on numbers. List.AnyTrue does not treat 1 as true or 0 as false. Convert numbers to logical with a conditional column or Number.From logic before testing.
- Mismatched parentheses. The M formula bar is strict. A missing closing parenthesis produces a syntax error that points to the wrong place, so count brackets carefully.
Tips
- Use List.AnyTrue when you only care whether at least one row passes a condition. It short-circuits on the first true value, so it is efficient on long lists.
- Pair it with List.AllTrue when you need to confirm every item is true, or List.NonNullCount to check for blanks.
- Add a comment in the formula bar using
//to explain why the check exists, especially in shared workbooks. - If you need the count of true values rather than a yes/no answer, use List.Count(List.Select(MyList, each _ = true)) instead.
- Test with a small Enter Data table before applying the function to a large query. It is faster to debug.
Troubleshooting
If you see "We cannot convert a value of type Table to type List", you passed a table where a list is required. Select the column and use Transform > To List, or wrap the table reference in Table.Column with the exact column name.
If the result is always false even though you can see true values, check the data type of the column. Text values that look like true are not logical true. Change the type to True/False and refresh the preview.
If the function errors with "Expression.SyntaxError: Token Comma expected", a parenthesis or comma is misplaced. Rebuild the expression slowly: start with the list step, confirm it returns a list, then wrap it.
If the query is slow, check whether the list step is pulling from an external source repeatedly. Materialize the list into a step first, then reference that step in List.AnyTrue.
If the result does not update after changing source data, click Refresh Preview on the Home tab. Power Query caches previews, so the formula bar result can look stale.
Frequently Asked Questions
Does List.AnyTrue work on a column with blanks?
Blanks are not logical true, so they are ignored for the purpose of finding a true value. If every item is blank or false, the function returns false. If the list contains nulls mixed with true, it returns true.
Can I use List.AnyTrue on a list of text values?
No. It expects logical values. Convert text such as "Yes"/"No" to true/false first, for example with a conditional column or Table.TransformColumns.
What is the difference between List.AnyTrue and List.Contains?
List.AnyTrue checks whether any item is the logical value true. List.Contains checks whether a specific value exists in the list, which can be text, number, or logical. Use List.Contains(MyList, true) if you want a direct value match.
Does List.AnyTrue stop at the first true value?
Yes, it short-circuits. That makes it faster than counting all true values when you only need a yes/no answer.
Can I use List.AnyTrue inside a custom column?
Yes, but the list must be available in that row context. A common pattern is to group rows first, then apply List.AnyTrue to the grouped column using Table.Group with a custom aggregation.
Is List.AnyTrue available in Power Query Online?
Yes. It is part of the standard M library and works in Excel, Power BI Desktop, and Power Query Online. The editor interface differs, but the function syntax is the same.