Forum Discussion
How to Dynamically change between PowerBI.Dataflows and PowerPlatform.Dataflows Connectors
Hi AKD ,
According to your description, please try to use a parameter that controls the connector type and pass it as an argument to a custom function that returns the appropriate connector. For example, you can create a parameter called ConnectorType and set its value to either “PowerBI” or “PowerPlatform”. Then, you can create a custom function called GetConnector that takes the parameter as an input and returns either PowerBI.Dataflows(null) or PowerPlatform.Dataflows(null) depending on the parameter value. You can use an if-then-else statement to implement the logic. Here is an example of the code for the custom function:
let
GetConnector = (ConnectorType as text) as function =>
if ConnectorType = "PowerBI" then
PowerBI.Dataflows(null)
else if ConnectorType = "PowerPlatform" then
PowerPlatform.Dataflows(null)
else
error "Invalid connector type"
in
GetConnector
You can then use this custom function in your queries to get data from dataflows. For example, you can write something like this:
let
Source = GetConnector(ConnectorType),
...
in
...
This way, you can dynamically change the connector type by changing the value of the parameter.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AKD3 years agoNew Member
Hello!
Thanks for your help!
Maybe some point is missing.🤔
This is the result: