# List.AllTrue

## #

In this article, we will take a closer look at the M code behind the Power Query M function List.AllTrue. This function is used to determine if all the values in a list are true. Let’s dive in!

## Syntax

Before we dive into the M code, let’s look at the syntax of the List.AllTrue function. The function takes a single argument, which is a list of values. It returns a Boolean value that indicates whether all the values in the list are true.

Here’s the syntax of the List.AllTrue function:

List.AllTrue(list as list) as logical

``` M Code Explanation Now that we know the syntax of the List.AllTrue function, let's take a closer look at the M code behind it. The M code for the List.AllTrue function is actually quite simple. Here's the code: ```

(list) => List.AllTrue(list)

``` The code consists of a lambda expression that takes a single argument, which is a list of values. The lambda expression then calls the List.AllTrue function, passing in the list of values as an argument. The List.AllTrue function returns a Boolean value that indicates whether all the values in the list are true. The lambda expression then returns this Boolean value as the result of the function. How List.AllTrue Works Now that we know what the M code behind the List.AllTrue function looks like, let's take a closer look at how the function works. The List.AllTrue function works by iterating through all the values in the input list. If any of the values are false, the function returns false. If all the values in the list are true, the function returns true. Here's an example of how the List.AllTrue function works: ```

List.AllTrue({true, true, true}) // returns true

List.AllTrue({true, false, true}) // returns false

``` In the first example, all the values in the input list are true, so the function returns true. In the second example, one of the values in the input list is false, so the function returns false. In this article, we took a closer look at the M code behind the Power Query M function List.AllTrue. We learned that the function works by iterating through all the values in the input list and returning true if all the values are true, and false otherwise. We also saw that the M code behind the function is quite simple, consisting of a lambda expression that calls the List.AllTrue function. Overall, the List.AllTrue function is a useful tool for checking whether all the values in a list are true, and it showcases the power and flexibility of the M language in Power Query. Power Query and M Training Courses by G Com Solutions (0800 998 9248) Power Query and M Intensive Training Course £1,050.00 – £26,550.00 Select optionsContinue Loading Done Power Query and M Introduction £395.00 – £9,750.00 Select optionsContinue Loading Done Power Query and M Intermediate £395.00 – £9,750.00 Select optionsContinue Loading Done Power Query and M Advanced £395.00 – £9,750.00 Select optionsContinue Loading Done Upcoming Courses Contact Us Subject Your Name (required) Company/Organisation Email (required) Telephone Training Course(s) Power BI Intensive TrainingPower BI introduction Power BI IntermediatePower BI AdvancedDAXPower Query MPower BI CertificationPower BI AdministrationPower PlatformPower AutomatePower AppsOTHER Your Message Upload Example Document(s) (Zip multiple files) ```
``` ```
``` ```
``` ```
``` ```
``` ```