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

Join us at FabCon Vienna from September 15-18, 2025, for the ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM. Get registered

Reply
amien
Helper V
Helper V

consuming a variable in a copy data job?

In a pipeline i run a notebook. In the end of this notebook i do a mssparkutils.notebook.exit

 

After the notebook is done, i have added a 'Set variable' with this setting : @activity('Notebook').output.result.exitvalue

This all works fine.

 

Now in my next step, i want to do a Copy data, using a query AND using the above mentioned variable. This part doesn't work.

I have this one in my query:

 

SELECT Week, Value FROM TableName WHERE Week = @variables('Maxweek_')

 

Is this not correct?

 

 

2 ACCEPTED SOLUTIONS
KNP
Super User
Super User

I think the syntax should be something like...

 

@concat(
'select week, value from TableName where week = '
, variables('Maxweek_')
)

 

depending on how you've written your variable, you may need to enclose it in quotes, and the escaping of quotes can be confusing...

 

@concat(
'select week, value from TableName where week = '
, ''''
, variables('Maxweek_')
, ''''
)

 

So that '''' is surrounding the concat item in '' and then another '' one to escape the other.

 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x

View solution in original post

KNP
Super User
Super User

Yeah, you need to use the add dynamic content option for this.

 

KNP_0-1730314665310.png

 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @amien ,

 

Did KNP reply solve your problem? If so, please mark it as the correct solution, and point out if the problem persists.

 

Best regards,

Adamk Kong

KNP
Super User
Super User

Yeah, you need to use the add dynamic content option for this.

 

KNP_0-1730314665310.png

 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x
KNP
Super User
Super User

I think the syntax should be something like...

 

@concat(
'select week, value from TableName where week = '
, variables('Maxweek_')
)

 

depending on how you've written your variable, you may need to enclose it in quotes, and the escaping of quotes can be confusing...

 

@concat(
'select week, value from TableName where week = '
, ''''
, variables('Maxweek_')
, ''''
)

 

So that '''' is surrounding the concat item in '' and then another '' one to escape the other.

 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x

it does work (first option) .. only thing is that it will remove the 'edit' button 🙂

 

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June FBC25 Carousel

Fabric Monthly Update - June 2025

Check out the June 2025 Fabric update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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