SharePoint list

Power BI is a powerful tool for data analysis and visualization. It allows users to connect to a variety of data sources, including SharePoint lists. In this article, we will explore how to use Power Query M Language code to connect to a SharePoint list data source from within Power BI.

Introduction to Power Query M Language

SharePoint list

Power Query is a data connection and transformation tool that is integrated into Power BI. It allows users to connect to various data sources, transform the data, and load it into Power BI for analysis and visualization. Power Query M Language is the language used by Power Query to manipulate and transform the data.

Connecting to SharePoint list Data Source

To connect to a SharePoint list data source from within Power BI, follow these steps:

1. Open Power BI and go to the Home tab.

2. Click on the Get Data button and select SharePoint Online List.

3. Enter the URL of the SharePoint site and select the list you want to connect to.

4. Click on the Edit button to open the Power Query Editor.

5. In the Power Query Editor, click on the Advanced Editor button to open the Advanced Editor window.

6. In the Advanced Editor window, you will see the Power Query M Language code that was generated to connect to the SharePoint list data source.

7. You can modify the code to suit your needs. For example, you can add filters to the data, rename columns, or perform other transformations.

8. Once you have made your modifications, click on the Close & Apply button to load the data into Power BI.

Power Query M Language Code for Connecting to SharePoint list Data Source

The following is an example of Power Query M Language code that can be used to connect to a SharePoint list data source:


let

Source = SharePoint.Tables(“[URL]”, [ApiVersion = 15]),

[List Name]_dbo = Source{[Name=”[List Name]_dbo”]}[Items],

#”Expanded [Column Name]” = Table.ExpandRecordColumn([List Name]_dbo, “[Column Name]”, {“[Column Name]”}, {“[Column Name].[Column Name]”}),

#”Filtered Rows” = Table.SelectRows(#”Expanded [Column Name]”, each [Column Name].[Column Name] = “Value”),

#”Renamed Columns” = Table.RenameColumns(#”Filtered Rows”,{{“[Original Column Name]”,”[New Column Name]”}})

in

#”Renamed Columns”


In this code, replace the following placeholders:

– [URL] with the URL of your SharePoint site.

– [List Name] with the name of the SharePoint list you want to connect to.

– [Column Name] with the name of the column you want to filter on.

– “Value” with the value you want to filter on.

– “[Original Column Name]” with the name of the original column you want to rename.

– “[New Column Name]” with the new name you want to give the column.

Conclusion

By using Power Query M Language code, you can connect to a SharePoint list data source from within Power BI and perform various data transformations. This allows you to get the most out of your data and create powerful visualizations that can help you make better business decisions.

Power BI Training Courses by G Com Solutions (0800 998 9248)

Contact Us

    Subject

    Your Name (required)

    Company/Organisation

    Email (required)

    Telephone

    Training Course(s)

    Your Message

    Upload Example Document(s) (Zip multiple files)

    Similar Posts