Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Help with DW Schema queries

I'm working with multiple servers which have the same database, so I have to combine them. Sometimes they stop working, so I set parametes (ACT_Source...) to indicate if they are online or not. The ...
  • Vijay_A_Verma's avatar
    4 years ago

    Use this (I can't see you passing Database here. You might need to replace Database with something like "Database" here depending upon your database name)

     

    let
        fxConnection =
            (server as text) as table =>
                Table.AddColumn(
                    Sql.Database(server, Database){[Schema="DW",Item="DEClass"]}[Data],
                    "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"