Cube.DisplayFolders

D

T

The M Code Behind the Power Query M function Cube.DisplayFolders

Understanding Cube.DisplayFolders

Before we dive into the M code behind Cube.DisplayFolders, let’s first take a look at what this function does. Cube.DisplayFolders is a function that is used to organize columns in a PivotTable or a Power View report.

When you create a PivotTable or a Power View report, you may have a lot of columns in your data. However, not all of these columns are relevant or important for your report. This is where Cube.DisplayFolders comes in. This function allows you to group columns into folders, making it easier to find the columns you need.

The M Code Behind Cube.DisplayFolders

Now that we understand what Cube.DisplayFolders does, let’s take a look at the M code behind this function. When you create a PivotTable or a Power View report in Excel, you can use the Cube.DisplayFolders function to organize your data. Here is the M code that you can use to do this:


Cube.DisplayFolders = [

Folder1 = {“Column1”, “Column2”, “Column3”},

Folder2 = {“Column4”, “Column5”, “Column6”}

]


In the above code, we can see that Cube.DisplayFolders is a list of folders. Each folder is represented by a name and a list of columns.

For example, let's say we have a dataset with six columns: Column1, Column2, Column3, Column4, Column5, and Column6. In the above code, we have created two folders: Folder1 and Folder2. Folder1 contains Column1, Column2, and Column3, while Folder2 contains Column4, Column5, and Column6.

Using Cube.DisplayFolders in Power Query

Now that we know how to use Cube.DisplayFolders in Excel, let's take a look at how we can use this function in Power Query.

In Power Query, Cube.DisplayFolders is called Cube.ColumnGroupings. Here is the M code that you can use to create column groups in Power Query:


Cube.ColumnGroupings = [

Folder1 = {“Column1”, “Column2”, “Column3”},

Folder2 = {“Column4”, “Column5”, “Column6”}

]


In the above code, Cube.ColumnGroupings is a list of folders, just like Cube.DisplayFolders in Excel. Each folder is represented by a name and a list of columns.

Cube.DisplayFolders is a powerful M function that can help you organize your data in a much better way. By grouping columns into folders, you can make it easier to find the columns you need in a PivotTable or a Power View report.

In this article, we explored the M code behind Cube.DisplayFolders and how it works in Excel and Power Query. We hope that you found this article helpful and that you can now use Cube.DisplayFolders to organize your data more effectively.

Power Query and M Training Courses by G Com Solutions (0800 998 9248)

Upcoming Courses

Contact Us

    Subject

    Your Name (required)

    Company/Organisation

    Email (required)

    Telephone

    Training Course(s)

    Your Message

    Upload Example Document(s) (Zip multiple files)