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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
yuvalf
Frequent Visitor

Share a function between dataflows

I have created a function in dataflow. Can this function be called from other dataflows ?
I have set of generic functions that seems to be useful in multiple dataflows. I don't want to copy each time the function from one dataflow to the others....instead, I would like to have 1 dataflow that include all these generic functions that can be called from the other dataflows, Is it possible ?
If not, what is the best practice to have 1 main repository of functions (without to copy it each time into the dataflow)
Thanks
Yuval

 

7 REPLIES 7
lbendlin
Super User
Super User

Nice question. Feels like this should go into the Ideas section.

 

Short answer is no - you cannot share functions across datasets or dataflows.  You need to maintain your own function repository (ideally on github) and then copy to your new dataflows.

 

Or - concentrate them all in one master dataflow.

 

Can you give an example of such a function?  Recursive web contents fetching?

E.g. - There is a specific KPI in our organization that should be calculated from various sources. This is a complicated KPI formula that should be used by different organization (in which each one has it own dataflow).
Currently, I am trying to take some work around using the Expression.Evaluate function in which the formula will be stored on shared location that this function will evaluated....not sure if it will work all the way (I read some articles that there are some problems when there is a need to schedule the dataflow)......

HI @yuvalf,

If these operations are in the same dataflow, you can try to create a custom function in your dataflow to package the rest API of these calculations and return results.

Then you can invoke this custom function in other entities.

Using Custom Functions in Power BI Dataflows 
If you mean invoke cross dataflow, perhaps you can take a look at computed/linked entities if they suitable for your requirement. (I'm not so sure if custom functions can be used as linked entities)

Premium features of dataflows 
Regards,

Xiaoxin Sheng

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

Sheng, I know that you can define a custom function in the dataflow - This is not the issue.

What I am looking for is after you create such function in one dataflow how you can "call" it from different dataflow (and not by coping the custom function from one dataflow to the second one).

Looking for a "1 truth of code" that can be shred among multiple dataflows.

Hi @yuvalf,

If you mean to create a standalone function in dataflow that can be directly invoked across different dataflows.
Current power bi dataflows do not support this, perhaps you can submit an idea with this requirement.
BTW, I think lbendlin 's suggestion should be a choice to indirectly achieve your retirement. You can package your functions externally then you can create new dataflow query tables to invoke these functions.

Regads,

Xiaoxin Sheng

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

Thanks,

What do you mean "You can package your functions externally" ?

 

Hi @yuvalf,

These operations were similar to design APIs and deploy them on the web. 

Then you can use a web connector to invoke the API instead of copy specific processing codes into your dataflow every time you used it. (it can be a workaround to use functions across dataflows but they not suitable for your requirements)

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
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

Users online (717)