問題描述
有沒有辦法在 PowerBI 中創建交互式對話框?
我在查詢編輯器中嵌入了 R 腳本,并且我希望有一個可以使用的交互方面:
file<-winDialogString("文件輸入?","")
此輸入將用作讀取 csv 的文件位置,每次有人打開并執行 PowerBI 文件的主副本時,他們都可以輸入新的文件位置.
我也對 html、javascript、python... 任何可以提供幫助的東西持開放態度.
實現您在 Power BI 中提到的最佳方法是利用
讓Source = Csv.Document(File.Contents("\MacHomeDownloadsSalesJan2009.csv"),[Delimiter=",", Columns=12, Encoding=1252, QuoteStyle=QuoteStyle.None]),#"PromoteHeaders" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Transaction_date", type datetime}, {"Product", type text}, {"Price", Int64.Type}, {"Payment_Type",鍵入文本},{名稱",鍵入文本},{城市",鍵入文本},{州",鍵入文本},{國家",鍵入文本},{帳戶創建",鍵入日期時間},{"Last_Login", type datetime}, {"Latitude", type number}, {"Longitude", type number}})在#改變類型"
如果我們希望用戶輸入文件位置(即\MacHomeDownloads
),我們可以在Power BI中設置一個參數:
然后我們可以更新查詢使用參數:(Query -> Advanced Editor)
讓Source = Csv.Document(File.Contents(#"FileLocation" & "SalesJan2009.csv"), ......
如果用戶以后想更改參數(文件位置),他們可以編輯參數并應用更改以刷新數據.
附:您甚至可以進一步 將 Power BI 文件導出為模板以允許用戶將其實例化為新的 Power BI Desktop 報表(PBIX 文件).
Is there a way to create an interactive Dialog box in PowerBI?
I have R script embedded into the query editor, and I would like to have an interactive aspect to where I can use:
file<-winDialogString("File input?","")
This input would be used as the file location for a read csv and everytime someone opens and executes the Master copy of the PowerBI file, they can input a new file location.
I am also open to html, javascript, python... anything that could help.
The best way to achieve what you mentioned in Power BI is to make use of parameters
and parameterize your queries to get the csv file.
Say we have a csv file named SalesJan2009.csv
. When you import it to Power BI you should have something like:
let
Source = Csv.Document(File.Contents("\MacHomeDownloadsSalesJan2009.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"
If we want users to input the file location (i.e. \MacHomeDownloads
), we can set up a parameter in Power BI:
Then we can update the query to use the parameter: (Query -> Advanced Editor)
let
Source = Csv.Document(File.Contents(#"FileLocation" & "SalesJan2009.csv"), ...
...
If users want to change the parameter (file location) later on, they can edit the parameter and apply changes to refresh the data.
P.S. You can even further export the Power BI file as a template to allow users to instantiate it as a new Power BI Desktop report (PBIX file).
這篇關于PowerBI 中的交互式對話框的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!