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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
akashgera
Helper I
Helper I

Creating global variable and referencing it in power query

Hello Folks,

I need your help in creating a global variable which will store a text value (known as access token), which will be used to assign a value to the headers in the Web.Contents function in my power query, As I am doing this because my access token expires in every 1 hour and I need to generate it manually via POSTMAN and have to replace that value in all queries as the data source for all queries are same i.e. web service, So I need to replace the access token value in all my queries every time I regenerate it which will takes a lot of time.

So, in order to replace the values in each query and I want to create a global variable which will store my text value and can work dynamically in all my queries and that needs to be changed at a single place rather than changing it everywhere. 

I want expected result like below:-

 

let

Source = Json.Document(Web.Contents("URL", [Headers=[Authorization="variable"]]))

in 

source

1 ACCEPTED SOLUTION
wdx223_Daniel
Super User
Super User

just create a independent qurey, say MyToken, and let it return the token text

then you can reference MyToken as variable everywere.

View solution in original post

2 REPLIES 2
wdx223_Daniel
Super User
Super User

just create a independent qurey, say MyToken, and let it return the token text

then you can reference MyToken as variable everywere.

Thank you so much for your response, I have followed your instructions and my global variable is woking fine.

People like you are much needed in this Pbi community, Kudos to you and your skillset !!👍

Much Appreciated 🙂

 
 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

Top Solution Authors
Top Kudoed Authors