Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Is it possible to create a Power BI desktop report/query using M and/or DAX from within Visual Studio?
I collect data to define the query from an ASP.NET application, so I can create a view in SSMS, but I want to also create a Power BI report based on this view and add measures, all within ASP.NET. Is this possible?
I think you're requiring some feature like programmatically create a pbix file in code, right? So far it is not implemented yet, you can vote up this idea Power BI Designer API.
Now you can only create the report in Power BI desktop, connecting to the view. May I know why you need to create the report pbix programmatically? As the reports can be fixed in many business, you just need to update the datasource.
Thanks for your reply, and yes that is what I want to be able to do, to create a pbix programmatically.
At the momment I create a view programattically and use this as a data source for reports. However, each view created for a customer (and there could be 100's) needs a few measures created as well as getting the data into the report.
It would be excellent if the pbix could be created programmatically including the measures, so the user does not need to be concerned with using DAX.
That's my aim. Seems like other products can do this, so Power BI should open up an API also. I've added my votes.
@markduffill wrote:
Thanks for your reply, and yes that is what I want to be able to do, to create a pbix programmatically.
At the momment I create a view programattically and use this as a data source for reports. However, each view created for a customer (and there could be 100's) needs a few measures created as well as getting the data into the report.
It would be excellent if the pbix could be created programmatically including the measures, so the user does not need to be concerned with using DAX.
That's my aim. Seems like other products can do this, so Power BI should open up an API also. I've added my votes.
Maybe one view for all customers and the customers can see their own data? Power BI does have a Row Level Security feature.
It's more the ability to create measures programmatically that I am interested in
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 |
| User | Count |
|---|---|
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 2 |