问题描述
我想从我的 SQL Server 表中生成报告.
I want to generate reports from my SQL Server tables.
我已经创建了一些存储过程,我想用它们来生成报告.
I have some already made stored procedures that I would like to use to generate reports from.
我还没有找到方法.
仅通过重写查询.
谢谢:)
推荐答案
在 Power BI 中执行你的 SP-->
To execute your SP in Power BI-->
1.在 SQL Server 中右键单击您的 SP 并选择执行.您的代码被执行,并打开一个负责执行的新查询窗口.复制该查询.
1.In SQL Server right click on your SP and select Execute. Your code is executed and a new query window opens up which was responsible for execution. Copy that Query.
2.在 Power BI 查询编辑器中,选择新建源-->SQL Server.给出服务器和数据库后,在同一窗口中单击高级选项",将查询粘贴到打开的SQL 语句"中.选中使用完整层次结构导航"并单击确定".
2.In Power BI Query Editor, select New Source-->SQL Server. After giving the server and database, in the same window click on "Advanced Options", paste the query in the "SQL Statement" that opened up. Check "Navigate using full hierarchy" and click OK.
3.您只会看到您在 SP 中传递的参数的数据.
3.You will see data for the parameters you passed in SP only.
- 应用这些更改后,您将在 Power BI Desktop 中看到此数据集,您可以从中创建报表.
注意:这适用于导入查询"选项.
NOTE: This works in"Import Query" option.
希望这对你有用,就像对我一样,干杯!
Hope this works for you as it did for me, Cheers!
这篇关于如何在 Microsoft PowerBI 中使用 SQL Server 存储过程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!