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

查看:9
本文介绍了如何在 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.这里是一个例子.尽管 API 可能无法胜任这项任务,但 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.

使用中间数据库/数据集市/数据仓库对数据进行建模并在数据存储之上运行 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天全站免登陆