Solver

Power Query is a data connectivity, transformation, and preparation tool that is used to shape and transform data from a variety of sources, including databases, web services, and spreadsheets. It is a great tool for BI professionals who want to create meaningful insights from their data, and it is also an essential tool for data analysts and data scientists who want to use data to drive business decisions.

Solver

One of the key features of Power Query is the ability to connect to external data sources, such as the Solver add-in for Excel. Solver is a powerful optimization tool that allows you to create and solve complex optimization models in Excel. By connecting Solver to Power Query, you can create custom optimization models on your data and visualize the results in Power BI.

In this article, we will explore how to use Power Query M Language Code for connecting to the Solver data source from inside Power BI.

Setting Up Solver

Before we can connect Solver to Power Query, we need to install the Solver add-in for Excel. This can be done by navigating to the “Insert” tab in Excel and clicking on “Add-ins.” From there, you can search for “Solver” and install the add-in.

Once Solver is installed, we can begin connecting it to Power Query.

Connecting Solver to Power Query

Solver

To connect Solver to Power Query, we need to write M Language code that will establish the connection. M Language is the programming language used by Power Query to transform and prepare data.

The first step in connecting Solver to Power Query is to create a new query. This can be done by navigating to the “Home” tab in Power Query and clicking on “New Source” > “Blank Query.”

Once the new query is created, we can begin writing the M Language code. The code for connecting Solver to Power Query will look something like this:


let

Source = Excel.CurrentWorkbook(){[Name=”TableName”]}[Content],

SolverData = Source{[SolverData=true]}[Data]

in

SolverData


This code assumes that the Excel table containing the Solver data is named “TableName.” You will need to replace this with the actual name of the table in your workbook.

Once the code is written, we can use it to create a new connection to the Solver data source. To do this, we need to navigate to the “View” tab in Power Query and click on “Advanced Editor.” From there, we can paste the M Language code into the editor and click “Done.”

Using Solver in Power BI

Now that Solver is connected to Power Query, we can begin using it in Power BI.

To do this, we need to create a new query that references the Solver data source. This can be done by navigating to the “Home” tab in Power Query and clicking on “New Source” > “Excel.”

From there, we can select the workbook that contains the Solver data source and select the sheet that contains the data.

Once the data is loaded into Power Query, we can begin shaping and transforming it to create custom optimization models. This can be done using the various tools and functions available in Power Query, such as filtering, grouping, and aggregating.

Once the data is shaped and transformed, we can create visualizations in Power BI that display the results of our optimization models. This can be done using the various visualization tools available in Power BI, such as charts, tables, and maps.

Conclusion

In conclusion, connecting Solver to Power Query is a powerful way to create custom optimization models on your data and visualize the results in Power BI. By using M Language code, we can establish a connection to the Solver data source and begin using it in Power BI. With the right tools and techniques, we can create meaningful insights from our data and use it to drive 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