Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
markduffill
Advocate I
Advocate I

Create a query/report in Visual Studio

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?

5 REPLIES 5
Eric_Zhang
Microsoft Employee
Microsoft Employee

@markduffill

 

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

@markduffill

Then you have to vote up the idea in my first reply.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.