Forum Discussion
Anonymous
4 years agoNot applicable
Skip connection if server is down with Power Query
I'm trying to set parameters on PBI, and then check in a query if the related servers are on or not. So I set 3 parameters to indicate the status of the servers: ACT_SourceARA = 1 ACT_SourceGOI = ...
- 4 years ago
Use below code
let fxConnection = (server as text) as table => Table.AddColumn( Sql.Database(server, "Database"), "Server", each server ), #"CombinedTables" = Table.Combine(List.RemoveNulls( { if ACT_SourceARA = 1 then fxConnection(ARA) else null, if ACT_SourceGOI = 1 then fxConnection(GOI) else null, if ACT_SourceIBI = 1 then fxConnection(IBI) else null }) ) in #"CombinedTables"
Vijay_A_Verma
4 years agoMost Valuable Professional
Use below code
let
fxConnection =
(server as text) as table =>
Table.AddColumn(
Sql.Database(server, "Database"),
"Server",
each server
),
#"CombinedTables" =
Table.Combine(List.RemoveNulls(
{
if ACT_SourceARA = 1 then
fxConnection(ARA)
else
null,
if ACT_SourceGOI = 1 then
fxConnection(GOI)
else
null,
if ACT_SourceIBI = 1 then
fxConnection(IBI)
else
null
})
)
in
#"CombinedTables"- Anonymous4 years agoNot applicable
Thank you so much Vijay_A_Verma !!!
It is a simple solution and works perfectly.