M power query - rebuild this data combination

你。 提交于 2021-02-05 10:47:25

问题


Getting the error message on the below query in M, I've tried splitting into 2 different queries before the merge step but still getting the 'this does not directly access a data source, please rebuild the data combination' error

*let
    Source = #"Query List from SP",
    cols = if {"Type"} = "Indicator" then 4 else 5,
    DataLoad = (path) =>
    let
       Doc =
           Csv.Document(
               Web.Contents(
                    BaseUrl,
                    [Headers =[#"Content-type"="text/csv",
                               #"Authorization"="Basic " & Credential],
                     RelativePath=path
                    ]), [Delimiter=",", Columns=cols, Encoding=65001, QuoteStyle=QuoteStyle.None]),
                    #"Promoted Headers" = Table.PromoteHeaders(Doc, [PromoteAllScalars=true]),
                    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Data", type text}, {"Organisation unit", type text}, {"Period", type text}, {"Value", type number}}
)
      in
         #"Changed Type",
     out = Table.AddColumn(
           Source,
           "res",
           each DataLoad([Path])
           ),
     #"Removed Errors" = Table.RemoveRowsWithErrors(out, {"res"}),
    #"Expanded res" = Table.ExpandTableColumn(#"Removed Errors", "res", {"Data", "Category option combo", "Organisation unit", "Period", "Value"}, {"Data", "Category option combo", "Organisation unit", "Period.1", "Value"}),
    #"Removed Columns" = Table.RemoveColumns(#"Expanded res",{"GUIDs", "Period", "BaseUrl", "Credential", "Path"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Removed Columns",{{"Value", Int64.Type}}),
    #"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Period.1", "Period"}}),
    #"Replace Cat" = Table.RenameColumns(Table.RemoveColumns(Table.AddColumn(#"Renamed Columns", "colnew", each if [Data] = "VbgQkVibB4P" then "qCWoTDpiKeH" 
else if [Data] = "YfCLQ1zig8z" then "qCWoTDpiKeH" 
else if [Data] = "M6kVOHWcnK3" then "qCWoTDpiKeH" 
else if [Data] = "Wov7FpjPr4E" then "qCWoTDpiKeH" 
else if [Data] = "MTuFYrvAacn" then "qCWoTDpiKeH" 
else if [Data] = "uXuoTc5nxkd" then "qCWoTDpiKeH" 
else if [Data] = "DsLkV0VYy6q" then "qCWoTDpiKeH"
else [Category option combo]),{"Category option combo"}),{{"colnew", "Category option combo"}}),
    #"Inserted Merged Column" = Table.AddColumn(#"Replace Cat", "deco key", each Text.Combine({[Data], [Category option combo]}, "."), type text),
    #"Added Index" = Table.AddIndexColumn(#"Inserted Merged Column", "Index", 1, 1)
in
    #"Added Index"*

回答1:


You are not directly accessing the data source since you are linking to the query #"Query List from SP".

Much has been written on this topic. Chris Webb has a whole blog series related to data privacy settings, but the easiest way to get rid of this problem is to simply ignore privacy levels.

Go to Options and settings under the file menu:

Under the Privacy section choose to ignore the privacy levels:

Obviously, if you're building something that needs to manage privacy levels carefully, then this is the wrong approach and you'll need to be more careful. But when privacy levels aren't a concern, this is a simple and convenient fix



来源:https://stackoverflow.com/questions/51823280/m-power-query-rebuild-this-data-combination

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!