Monday, May 10, 2021

Power Query - Block IF THEN ELSE

 let

    Source = (ano as text) => let 

    

        EmptyTable = #table({"/BIC/ZMATERIAL",...}, {}),

        Source = PowerBI.Dataflows(null),


        //THEN

        WorkspacePRO = Source{[workspaceId="564564563466353653665"]}[Data],

        DataflowPRO = WorkspacePRO{[dataflowName=Text.Combine({"MIX_Full_", ano})]}[Data],

        FAT_PricesPRO = DataflowPRO{[entity=Text.Combine({"MIX_FullDetail_", ano})]}[Data],

    

        //ELSE

        WorkspacePPU = Source{[workspaceId="356633456346456456456"]}[Data],

        DataflowPPU = WorkspacePPU{[dataflowName=Text.Combine({"MIX_Full_", ano})]}[Data],

        FAT_PricesPPU = DataflowPPU{[entity=Text.Combine({"MIX_FullDetail_", ano})]}[Data],


        Final_Table = if PRO_PPU = "PRO" then 

        FAT_PricesPRO else 

        FAT_PricesPPU,

        

        Final_Table2 = try Final_Table otherwise EmptyTable

    in 

        Final_Table2

in

    Source

No comments:

Post a Comment

Power BI APP - Delete or Unpublish

 UNPUBLISH DELETE