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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Global Variable

 I am developing a custom connector ,  There are various methods which needs to have a same variable as parameter . Is there an way to declare a  variable global  , whose value keeps on changing after every method and hold their new value ?

5 REPLIES 5
kdevroede
Frequent Visitor

Hello,

 

Did you find a solution to this problem?

I have a similar problem where I need to store some state or global variable between the GetType and GetRows of Table.View.

 

Tx 

Koen

Anonymous
Not applicable

The idea of a global variable is not tied to table variables only, although scalar variables can be implemented through measures today. The fundamental difference with a calculated table, obviously, is that a global variable is evaluated at reporting time in a context-dependent way.

v-shex-msft
Community Support
Community Support

Hi @Anonymous,

In my opinion, I'd like to suggest you define this 'global variable' as a query parameter. It can be invoked in your query table/steps and you can manually modify it on power query side.

Using Query Parameters in Power BI Desktop 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Anonymous
Not applicable

@v-shex-msft  thanks , but I want to use it in my Custom Connector , not for report .  Is  there any way like this in custom connector? or power query?

 

HI @Anonymous,

It is possible to setting an optional parameter with default value in your connector, but you cant write back and change the default value which is defined in the custom connector. (New connector only existed the default value, changed new value not able sync to connections used the same connector)
For query parameters, you only need to invoke it in connections. These invoked parameter values will update if you modify the current value of query parameter.

For example:

Query parameter:

QP1=1, QP value will sync to all connectors who invoked it.

Your query tables:

Source1=CustomConnecotor(connectionstring1, QP1)

Source2=CustomConnecotor(connectionstring2, QP1)

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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