Blank Query
Power BI is a powerful business analytics service that allows users to analyze data and share insights. One of the key features of Power BI is the ability to connect to various data sources and transform the data using the Power Query Editor. The Power Query Editor is a data transformation and cleansing tool that allows users to clean, transform, and mashup data from various sources.
In this article, we will explore how to connect to the Blank Query data source from inside Power BI using Power Query M language code. The Blank Query data source is a blank table that can be used as a starting point for creating queries in Power Query Editor.
Understanding the Blank Query Data Source
The Blank Query data source is a simple data source that contains no data. It is an empty table that can be used as a starting point for creating queries in Power Query Editor. The Blank Query data source is useful when you want to create a new query from scratch and do not have any existing data to start with.
To create a Blank Query data source in Power BI, follow these steps:
1. Open Power BI Desktop and go to the Home tab.
2. Click on the “Get Data” button and select “Blank Query” from the list of data sources.
3. A new Blank Query will be created, and you can start adding data to it using the Power Query Editor.
Connecting to the Blank Query Data Source Using Power Query M Language Code
Power Query M language is a functional programming language used in Power Query Editor to transform data. It is a powerful language that allows users to create complex transformations and manipulations of data. Power Query M language is used to create custom functions, add columns, filter rows, and manipulate data in various ways.
To connect to the Blank Query data source using Power Query M language code, follow these steps:
1. Open Power BI Desktop and create a new Blank Query.
2. In the Power Query Editor, click on the “Advanced Editor” button in the “View” tab.
3. In the Advanced Editor, enter the following Power Query M language code:
let
Source = #table({},{}),
#”Changed Type” = Table.TransformColumnTypes(Source,{{“Column1”, type text}})
in
#”Changed Type”
The above code creates a new Blank Query by creating a new table with no columns and no rows. The first line of code creates a new table by using the #table function and passing in two empty lists. The second line of code changes the data type of the first column to text.
4. Click on the “Done” button to close the Advanced Editor.
5. Save the query by clicking on the “Close & Apply” button in the Home tab.
Conclusion
In this article, we explored how to connect to the Blank Query data source from inside Power BI using Power Query M language code. The Blank Query data source is a useful starting point for creating new queries in Power Query Editor. Power Query M language is a powerful language that allows users to create complex data transformations and manipulations. By understanding how to connect to the Blank Query data source using Power Query M language code, users can create custom queries and data transformations to meet their specific needs.