gpt4 book ai didi

javascript - PowerBI 中的交互式对话框

转载 作者:行者123 更新时间:2023-11-30 11:31:30 25 4
gpt4 key购买 nike

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

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

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

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

我也愿意使用 html、javascript、python...任何可以提供帮助的东西。

最佳答案

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

假设我们有一个名为 SalesJan2009.csv 的 csv 文件.当您将其导入 Power BI 时,您应该拥有类似以下内容的内容:

text/csv

data

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 中设置一个参数:

new parameter

file location

然后我们可以更新查询以使用参数:(查询 -> 高级编辑器)

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

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

edit parameters

enter parameters

apply changes

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

关于javascript - PowerBI 中的交互式对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46080640/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com