【问题标题】:Interactive Dialog Box in PowerBIPowerBI 中的交互式对话框
【发布时间】:2018-02-15 06:21:12
【问题描述】:

有没有办法在 PowerBI 中创建交互式对话框?

我在查询编辑器中嵌入了 R 脚本,并且我希望有一个可以使用的交互方面:

    file<-winDialogString("File input?","")

此输入将用作读取 csv 的文件位置,每次有人打开并执行 PowerBI 文件的主副本时,他们都可以输入新的文件位置。

我也对 html、javascript、python... 任何可以提供帮助的东西持开放态度。

【问题讨论】:

    标签: javascript python r powerbi m


    【解决方案1】:

    实现您在 Power BI 中提到的最佳方法是利用 parameters 并参数化您的查询以获取 csv 文件。

    假设我们有一个名为 SalesJan2009.csv 的 csv 文件。当您将其导入电源BI时,您应该有类似的东西:

    let
        Source = Csv.Document(File.Contents("\\Mac\Home\Downloads\SalesJan2009.csv"),[Delimiter=",", Columns=12, Encoding=1252, QuoteStyle=QuoteStyle.None]),
        #"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
        #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Transaction_date", type datetime}, {"Product", type text}, {"Price", Int64.Type}, {"Payment_Type", type text}, {"Name", type text}, {"City", type text}, {"State", type text}, {"Country", type text}, {"Account_Created", type datetime}, {"Last_Login", type datetime}, {"Latitude", type number}, {"Longitude", type number}})
    in
        #"Changed Type"
    

    如果我们希望用户输入文件位置(即\\Mac\Home\Downloads\),我们可以在Power BI中设置参数:

    然后我们可以更新查询使用参数:(Query -> Advanced Editor)

    let
        Source = Csv.Document(File.Contents(#"FileLocation" & "SalesJan2009.csv"), ...
        ...
    

    如果用户稍后想要更改参数(文件位置),则可以编辑参数并应用更改以刷新数据。

    附:您甚至可以进一步export the Power BI file as a template允许用户将其实例化为新的Power BI桌面报告(PBIX文件)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-13
      • 1970-01-01
      • 2021-08-03
      • 2012-10-18
      • 2022-10-08
      相关资源
      最近更新 更多