Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I have created a variable library in a premium workspace named "Variables_Dataflows".
In this library I have created a variable named "dfFactMroPurchasingDocuments" with value sets for DEV, QA and PROD.
DEV is the active value set for this workspace.
The variable is working fine when used in a data pipeline.
But when I try to use it in a dataflow residing in the smae workspace, either Gen1 or Gen2, it complains that it could not find the variable.
Here's the M code I used:
let
Source = Variable.Value("$(/**/Variables_Dataflows/dfFactMroPurchasingDocuments)")
in
SourceI can't figure out what's wrong with this code.
Anyone can tell me?
Solved! Go to Solution.
Hi @FireFighter1017 ,
In Dataflow Gen2, the Power Query editor does not resolve Variable Library values at design time, so Variable.Value("$(/**/Library/Variable)") often throws 10418 in the editor even when the variable exists. Variables are resolved at run time. Also, Variable Libraries are only supported in Dataflow Gen2 with CI/CD, not in Dataflow Gen1. See Microsoft’s docs and notes here: Use Fabric variable libraries in Dataflow Gen2 (Preview).
// Works in authoring (fallback) and resolves at run time
let
TableName =
Variable.ValueOrDefault(
"$(/* */*/Variables_Dataflows/dfFactMroPurchasingDocuments)",
"dfFactMroPurchasingDocuments_DevFallback" // match the variable's data type
),
Source = SomeConnectorFunction( TableName )
in
Source
If you found this helpful, consider giving some Kudos. If I answered your question or solved your problem, mark this post as the solution.
ok @tayloramy , that worked !
That explains why the few sources where I could see this code had more examples using Variable.ValueOrDefault().
I also just noticed the big red box telling us why we should use Variable.ValueOrDefault() in your 1st link.
I still have tests to do before I can safely assume this is working as expected.
I'm hoping to be able to replace all parameters for variables and get rid of deployment rules in deployment pipelines.
Am I wrong?
Hi @FireFighter1017,
There's use cases for both deployment pipeline rules and variable libraries, but I typically lean towards using only variable libraries as you are describing.
If you found this helpful, consider giving some Kudos. If I answered your question or solved your problem, mark this post as the solution.
Hi @tayloramy ,
Yeah I guess until Microsoft finally implements variables for both Gen1 Dataflows and Datasets we'll have to continue using deployment rules.
The funny thing is you can't go through CI/CD with Gen 2 Dataflows without using variables. They aren't supported for deployment rules.
Hi @FireFighter1017 ,
In Dataflow Gen2, the Power Query editor does not resolve Variable Library values at design time, so Variable.Value("$(/**/Library/Variable)") often throws 10418 in the editor even when the variable exists. Variables are resolved at run time. Also, Variable Libraries are only supported in Dataflow Gen2 with CI/CD, not in Dataflow Gen1. See Microsoft’s docs and notes here: Use Fabric variable libraries in Dataflow Gen2 (Preview).
// Works in authoring (fallback) and resolves at run time
let
TableName =
Variable.ValueOrDefault(
"$(/* */*/Variables_Dataflows/dfFactMroPurchasingDocuments)",
"dfFactMroPurchasingDocuments_DevFallback" // match the variable's data type
),
Source = SomeConnectorFunction( TableName )
in
Source
If you found this helpful, consider giving some Kudos. If I answered your question or solved your problem, mark this post as the solution.
Check Variable Scope
2. Use Correct Syntax
Try simplifying the path:
Source = Variable.Value("Variables_Dataflows/dfFactMroPurchasingDocuments")
Or even:
Source = Variable.Value("dfFactMroPurchasingDocuments")
Sometimes the full path with $(/**/) is not required in Dataflows.
3. Test with a Static Value
To isolate the issue, replace the variable call with a hardcoded value:
Source = "DEV"
If this works, the issue is with variable resolution—not the rest of your query.
4. Check Dataflow Type
5. Use Parameters Instead
If variables fail, consider using Dataflow Parameters as a workaround:
Source = ParameterName
Known Limitations
According to recent community feedback and Microsoft documentation:
Recommendation
Until full support is rolled out:
Hi @anilgavhane ,
The purpose of this is to specificaly stop using parameters in dataset and dataflows that need to reference existing dataflows. Mainly because it is a PIA to maintain in deployment pipeline rules.
We are starting to use data pipelines and using variable libraries seems like an obvious choice for future developments.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 56 | |
| 56 | |
| 35 | |
| 18 | |
| 14 |