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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
onbabu
Regular Visitor

Changing Data Soucrce Dynamically And Pass Session Values To Power BI Chart

Hi,

          I am Developing Power BI Charts by using Power BI Desktop, Sql Server db, I have some requirements such as

1.  How to give data souce sql db connection string(for example in .net we can sepecify connection string in web.config file), and get data dynamically.

2.  Is there any possible way to pass session values to Power BI Charts. i.e In my application I have CompanyID in session, I need to get chart with values based on Session CompanyID.

 

          Can any one help me in these issues.

 

Thanks In advance

Narendra.

1 ACCEPTED SOLUTION
Eric_Zhang
Microsoft Employee
Microsoft Employee


@onbabu wrote:

Hi,

          I am Developing Power BI Charts by using Power BI Desktop, Sql Server db, I have some requirements such as

1.  How to give data souce sql db connection string(for example in .net we can sepecify connection string in web.config file), and get data dynamically.

2.  Is there any possible way to pass session values to Power BI Charts. i.e In my application I have CompanyID in session, I need to get chart with values based on Session CompanyID.

 

          Can any one help me in these issues.

 

Thanks In advance

Narendra.


->1

In Power BI desktop, you can set paratemers and apply them to the Power query connection string. Check

Deep Dive into Query Parameters and Power BI Templates

Power BI Tutorial: How to Parameterize Connection Variables in Power Query

While after publishing, namely in Power BI Service, there's no way to change the connection string any more.

 

->2

Regarding "passing session values to Power BI Charts", AFAIK, Power BI Service REST APIs doesn't accept that "CompanyID in Session" while Power BI Embeded provides more flexibility and Row level security with Power BI Embedded seems able to handle your scenario.

View solution in original post

2 REPLIES 2
Eric_Zhang
Microsoft Employee
Microsoft Employee


@onbabu wrote:

Hi,

          I am Developing Power BI Charts by using Power BI Desktop, Sql Server db, I have some requirements such as

1.  How to give data souce sql db connection string(for example in .net we can sepecify connection string in web.config file), and get data dynamically.

2.  Is there any possible way to pass session values to Power BI Charts. i.e In my application I have CompanyID in session, I need to get chart with values based on Session CompanyID.

 

          Can any one help me in these issues.

 

Thanks In advance

Narendra.


->1

In Power BI desktop, you can set paratemers and apply them to the Power query connection string. Check

Deep Dive into Query Parameters and Power BI Templates

Power BI Tutorial: How to Parameterize Connection Variables in Power Query

While after publishing, namely in Power BI Service, there's no way to change the connection string any more.

 

->2

Regarding "passing session values to Power BI Charts", AFAIK, Power BI Service REST APIs doesn't accept that "CompanyID in Session" while Power BI Embeded provides more flexibility and Row level security with Power BI Embedded seems able to handle your scenario.

Anonymous
Not applicable

Eric did you test it before mark it as solution; as its does not support direct query; if you use and the second post more aligned to power query solution; i was unable to acheive it through powerbidesktop with out lot of tweaks.

 

Can you provide better solution link which caters PowerBI rather PowerQuery.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.