PowerBI 中的交互式对话框

Interactive Dialog Box in PowerBI(PowerBI 中的交互式对话框)
本文介绍了PowerBI 中的交互式对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

有没有办法在 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 中的交互式对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

业务场景:使用update语句去更新数据库字段。 原因:update接收值不正确。原来代码: $query = "UPDATE student SET date = now() WHERE id = $id";$result = $mysqli-query($query2) or die($mysqli-error); // 问题出现了在这句 $data = $result-fetch_ass
在layui树状组件tree中,勾选问题可以通过以下方法解决: 通过tree的oncheck事件来监听勾选操作,然后根据勾选状态进行相应的处理。例如: tree.on('check', function(obj) { // 获取勾选状态 var isChecked = obj.checked; // 获取当前节点数据 var data =
经常用到layui的朋友都知道,layui tree默认是不能自定义图标的,那么我们要自定义的话要怎么操作呢? 首先用编辑器软件(修改时候用编辑器记得编码),打开layui.js。搜索: i class="layui-icon layui-icon-file" 改为如下代码: i class="'+ (i.icon || "l
在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会
append() 方法在被选元素的结尾(仍然在内部)插入指定内容。 语法: $(selector).append( content ) var creatPrintList = function(data){ var innerHtml = ""; for(var i =0;i data.length;i++){ innerHtml +="li class='contentLi'"; innerHtml +="a href
问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转