Forum Discussion
connection function and error in the argument passed
- 2 years ago
if Value.Is(qury) is the source of the error. (It took me 2 days to figure it out and, guess what, co-pilot didn't spot it)
I replaced it by qury <>"" and it works.
enjoy the
(DB as text, optional qury as text) =>
let
ParametreTrouve = Table.SelectRows(connectors, each [env] = ENVDYN),
P_Server = if Table.RowCount(ParametreTrouve) > 0 then ParametreTrouve{0}[Server] else null,
P_DB = if Table.RowCount(ParametreTrouve) > 0 then Record.Field(ParametreTrouve{0}, DB) else null,
connection =
if qury <>"" then
Sql.Database(P_Server, P_DB ,[Query=qury])
else
Sql.Database(P_Server, P_DB)
in
connection
if Value.Is(qury) is the source of the error. (It took me 2 days to figure it out and, guess what, co-pilot didn't spot it)
I replaced it by qury <>"" and it works.
enjoy the
(DB as text, optional qury as text) =>
let
ParametreTrouve = Table.SelectRows(connectors, each [env] = ENVDYN),
P_Server = if Table.RowCount(ParametreTrouve) > 0 then ParametreTrouve{0}[Server] else null,
P_DB = if Table.RowCount(ParametreTrouve) > 0 then Record.Field(ParametreTrouve{0}, DB) else null,
connection =
if qury <>"" then
Sql.Database(P_Server, P_DB ,[Query=qury])
else
Sql.Database(P_Server, P_DB)
in
connection
- Anonymous2 years agoNot applicable
Thank you for sharing this solution, it's very helpful!
- fsim2 years agoResponsive Resident
Anonymous
unfortunately the report cannot be refreshed by powerBi service anymore.
https://aka.ms/dynamic-data-sources
Am I the only one that need to change the sources of the queries when publishing in different environments ?