Forum Discussion
Dataflow Gen1 can't use Value.Metadata trick
All,
I'm using this neat trick that I got from BI Gorilla to refer to an intermediate step of another query by using the meta function.
The solution looks like this:
QueryA:
just add to last step:
meta [variable = #"query step"]
QueryB: refer to the QueryA step using:
Source = Value.Metadata(QueryA)[variable]
You can add multiple variables to refer to multiple steps.
In Power BI Desktop this works excellent. In the dataflow the preview looks perfect as well, but after saving and refreshing I get an error message like this:
Error: Expression.Error: The field 'variable' of the record wasn't found.: MashupValueException. RootActivityId = ......Param1 = Expression.Error: The field 'variable' of the record wasn't found.: MashupValueException Request ID: ...
Any idea why the same code works in PBI desktop but fails in Dataflow Gen1?
Hii jeroenyahroon
In Power BI Desktop the trick works because the local Mashup engine keeps the metadata record attached to the value during evaluation, so Value.Metadata(QueryA)[variable] can be read by another query. In Dataflow Gen1, the cloud refresh engine re-evaluates and often drops/doesn’t persist custom metadata across queries/refresh, so after save/refresh that metadata record is no longer there hence “field ‘variable’ wasn’t found” even though the preview (client-side) looked fine. The practical workaround is: don’t rely on metadata for cross-query step references in Gen1 move the shared logic into a function/query you call from both, or explicitly materialize the needed step/output as its own query and reference that instead.
1 Reply
- rohit1991Super User
Hii jeroenyahroon
In Power BI Desktop the trick works because the local Mashup engine keeps the metadata record attached to the value during evaluation, so Value.Metadata(QueryA)[variable] can be read by another query. In Dataflow Gen1, the cloud refresh engine re-evaluates and often drops/doesn’t persist custom metadata across queries/refresh, so after save/refresh that metadata record is no longer there hence “field ‘variable’ wasn’t found” even though the preview (client-side) looked fine. The practical workaround is: don’t rely on metadata for cross-query step references in Gen1 move the shared logic into a function/query you call from both, or explicitly materialize the needed step/output as its own query and reference that instead.