如何在PowerBi中将切片器中的选定值设置为API [英] How to set selected value from slicer to API in PowerBi

查看:74
本文介绍了如何在PowerBi中将切片器中的选定值设置为API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从切片器中选择时间,并将用户选择的值放入API.从API获取值后,分析将在本地计算机上进行,并将分析后的数据设置为PowerBi(用于用户选择的数据).

I want to select the time from the slicer and put the user-selected value into API. After I get the value from API and analysis will be going on my local machine and set the analyzed data into PowerBi(for user-selected data).

我使用以下API设置了上述切片器.

I set the above slicer using the following API.

http://localhost:9002/ANC/analysis/parameterList

http://localhost:9002/ANC/analysis/parameterList

Python文件:

from flask import Flask, jsonify, abort,request
import time
app = Flask(__name__)

@app.route('/ANC/analysis/parameterList',methods=['GET'],endpoint='parameterList')
def parameters():
    data = {
            "time":["lastMonth","lastYear","lastWeek","lastHour","lastDay"],
           
            }
    return data

if __name__ == '__main__':
    app.run(debug=True,host='0.0.0.0',port=9002)


# url6 = 'http://localhost:9002/ANC/analysis/parameterList'

是否可以通过API PowerBi将用户选择的参数纳入本地分析?还是有什么方法可以解决这个问题?

Is it possible to get the user-selected parameter into local analysis via API PowerBi? Or is there any way to solve this?

推荐答案

PowerBI不能像Web开发框架那样工作.您不能发布"切片器中对API的选择.

PowerBI does not work like a web development framework. You cannot "post" the selection in a slicer to an API.

我认为某些选项可以提供可接受的替代方法:

I can think some options that could give an acceptable alternative:

  1. 您可以从API端点导入所有数据.然后使用切片器按设计切片.对于大量数据(在API中),存在使用M将数据分页到PowerBI的技术.

  1. You import all the data from the API endpoint. Then use the slicer to slice as designed. For large amounts of data (in the API) there are techniques for paging that data in to PowerBI using M. Here is an example. PowerBI will handled gigabytes of data with ease although the API might not be up to the task.

使用中间数据库/datamart/datawarehouse对数据进行建模,并在数据存储的顶部运行PowerBI.通过这种方法,您可以使用DirectQuery将处理的数据限制为PowerBI.

Use an intermediate database / datamart / datawarehouse to model the data and run your PowerBI on top of the datastore. With this approach you can use DirectQuery to limit the data you process through to PowerBI.

如果您在本地工作并且仅使用PowerBI桌面.您可以在PowerBI文件中设置参数,然后通过参数提供时间.如果将PowerBI文件另存为PowerBI模板(PBIT),则它将保存PowerBI而没有任何数据.当您打开模板时,它将提示您提供参数.

If you are working locally and only using PowerBI desktop. You can set parameters in your PowerBI file and then supply the time through the parameters. If you save your PowerBI file as a PowerBI template (PBIT), then it saves your PowerBI without any data. When you open the template it will prompt you to supply the parameters.

答案不是100%,但我希望它能为您提供一些可供考虑的选择.

Not quite a 100% answer but I hope it gives you some options to consider.

这篇关于如何在PowerBi中将切片器中的选定值设置为API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆