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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
balaji_it02
Frequent Visitor

Get value from other table or database in Power Query Editior

Dear all,

I am facing problem while passing one parameter value to API URL on Advanced query editior.

Access_token is dynamic value which we are getting from SQL database everytime.

 

I want to pass that dynamic value to API URL for getting API Data.

When i manually assign value to variable, it working, but i want this value to picked from sql database every time this dashboard refresh.

 

balaji_it02_0-1731529743339.png

 

 

2 ACCEPTED SOLUTIONS
Jai-Rathinavel
Super User
Super User

Hi Balaji,

 

Refer the below code to get the parameter value dynamically by retreiving from a SQL Database. 

V_Access_Token = Sql.Database("your_server_url", "your_database", [Query="Select MAX(Column) as Value from Table;"]){0}[Value]

 

Please accept this as a solution if this resolves your issue.

 

Thanks,

Jai 🙂




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

v-xinruzhu-msft
Community Support
Community Support

Hi,

Thanks for the solution Jai-Rathinavel  and PhilipTreacy  offered, and i want to offer some more information for user to refer to.

hello @balaji_it02 , If you have a date column in your accesstoken table, you can filter for the most recent token and apply it. e.g

 

let
    Source = Sql.Database(yourserver, yourdatabasename, [Query="SELECT *FROM [table] where [CreatedDate]=(select max([CreatedDate]) from [table])""]),
    AccessTokens = Source[AccessToken]{0}
in
    AccessTokens

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

3 REPLIES 3
v-xinruzhu-msft
Community Support
Community Support

Hi,

Thanks for the solution Jai-Rathinavel  and PhilipTreacy  offered, and i want to offer some more information for user to refer to.

hello @balaji_it02 , If you have a date column in your accesstoken table, you can filter for the most recent token and apply it. e.g

 

let
    Source = Sql.Database(yourserver, yourdatabasename, [Query="SELECT *FROM [table] where [CreatedDate]=(select max([CreatedDate]) from [table])""]),
    AccessTokens = Source[AccessToken]{0}
in
    AccessTokens

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Jai-Rathinavel
Super User
Super User

Hi Balaji,

 

Refer the below code to get the parameter value dynamically by retreiving from a SQL Database. 

V_Access_Token = Sql.Database("your_server_url", "your_database", [Query="Select MAX(Column) as Value from Table;"]){0}[Value]

 

Please accept this as a solution if this resolves your issue.

 

Thanks,

Jai 🙂




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





PhilipTreacy
Super User
Super User

@balaji_it02 

 

Create a query to get the dynamic token and then call it putting the result in V_Access_Token?

 

V_Access_Token = Query_to_get_Token

 

regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.