Future-Proof Your Career, Master Data Skills + AI

Blog

Blog

# Structured List Value – An Ordered Sequence Of Values

by | 7:00 pm EDT | September 23, 2021 | DAX, Power BI

In this tutorial, youâ€™ll learn how to create and utilize structured list values. You’ll also learn how to maximize them using different contexts and expressions to get the desired data and outcome. Shorthand methods will also be discussed to help create lists easily.

Table of Contents

## Creating Structured List Values

The list is an ordered sequence of values; its order is considered when you compare lists. The list initializer is a set of curly brackets. If you input curly brackets ({ }) in the formula bar and press Enter, youâ€™ll create an empty list. You can also see the icon associated with lists beside the query name in the Query page.

To create a list with values, first create a new query by right-clicking on the space inside the Query pane. Next, click New Query and select Blank Query.

Then, input your values in the formula bar. If you have multiple values, separate each of them using a comma. The values in the list donâ€™t need to be of the same type so they can either be a primitive or structured type. This is a list with a text, list, and record values:

## Using Double Dots For Sequential Numbers And Characters

If you need to create a list of sequential numbers, there’s a shorthand for that. First, input the initializer followed by the first number. Then, input two dots and then the last number.

You can see that it created a list of sequential numbers from 1 to 5. The numbers need to be incremental. So if you change the last number to -5, youâ€™ll get an empty list because the starting value is greater than the ending value.

This method also works with characters.

You can see that it created a list of characters from the first value to the ending value in the code. But if you change the values the other way around, it will show an empty list. This is because unicode character values associated with the characters are not incremental.

This is a query to further illustrate this process.

If you input this in the advanced editor window and press Done, youâ€™ll see the numeric values associated with the letters.

However, this method doesn’t work with dates. If you enter date values in the formula bar, youâ€™ll get an error message.

## Accessing An Item From A Structured List

There are other ways to create lists. You can use M functions that return lists or you can extract a single column from a table that will also return a list. But more commonly, lists are used as parameters in M functions. In these cases, it’s important that you know how to create a list so that you can provide that function with the correct parameter value.

To access an item in a list, you can refer to it by its zero-based position using the positional index operator. In this example, you can see that the index operator 0 pulled out the first value 1.

If you change the index operator from 0 to 2, youâ€™ll get the last value 3.

So if you want to retrieve the fourth item from the list by changing the index operator to 3, youâ€™ll get an error because there aren’t enough values in the list.

Adding a question mark to the position index operator changes the “not-found” behavior from returning an error to a null. This is also referred to as performing an optional item selection.

## Combining And Equating Lists

You can use the combination and equation operators with lists. Lists can be combined using the combination operator, ampersand (&).

The first list contains the numbers 1 to 5 and the second list contains 2 and 3. You can see that the lists are combined into a single list.

When comparing lists, the order is considered. In this example, you can see that the code yielded FALSE because they are not equal to each other.

## Conclusion

Structured list values are common in Power BI data reports because they show data and information in a list form. They help organize and categorize data to make reports look compelling. If you want to list certain texts, numbers, or even values, using lists is highly recommended.

Melissa

***** Related Course Modules *****
Power Query M Masterclass Part One
Power Query / M Masterclass #2 of 2
Mastering Report Development – Start To Finish

***** Related Support Forum Posts *****
Lookup From Two Lists

List Of Columns In Data Flow Table
Extract Data From List In Query Editor
For more lists queries to review see hereâ€¦.

## How to Calculate Age in Excel: 5 Best Methods Explained

Looking to calculate age in Excel? Well, you're in the right place. Whether you need to find the age of...

## Funny ChatGPT Prompts: 20 Hilarious ChatGPT Ideas

In a world where technology continues to amaze us, we have now arrived at the point where we can have a...

## Power BI Slicer Search: User Guide With Examples

Ready to get started with the Power BI slicer? This feature will allow you to filter and slice your...

## SUMPRODUCT Multiple Criteria: Explained With Examples

Most Excel users think that the SUMPRODUCT function in Excel helps only to multiply the numbers in...

## Data Analytics Outsourcing: Pros and Cons Explained

In today's data-driven world, businesses are constantly swimming in a sea of information, seeking the...

## How to Embed Power BI in Sharepoint: 4 Simple Steps

Embedding Power BI reports in SharePoint Online is a powerful way to display interactive data...

## The Top 5 Power BI Alternatives in 2023

Power BI has established itself as a powerful business analytics platform, offering a wide range of...

## How to Apply the Same Formula to Multiple Cells in Excel

One of Microsoft Excel's powerful features is using formulas to do calculations and changes to data in...

## Power BI Waterfall Chart: A Detailed User Guide

In the world of data visualization, charts speak louder than numbers. If you're looking for a way to...

## Power BI Import vs Direct Query: Which is Better & Why?

In the world of data analysis, Power BI offers you a range of tools to connect to your data sources....

## Power BI Certification: Everything You Need to Know

In today's data-driven world, the ability to transform raw numbers into meaningful insights is more...

## grep & grepl R Functions Explained With Examples

A common task in data analysis is the need to find specific patterns within text data. Pattern...