简体   繁体   English

在Power BI中执行内部联接

[英]Performing an Inner Join in Power BI

I'm currently having an issue displaying data in Power BI, this data is being retrieved from a star schema. 我目前在Power BI中显示数据时遇到问题,该数据是从星型模式中检索到的。 Let's say I want to display data from 2 dimensions in one table of power BI, as you will see here, It looked like the power BI would be doing a wrong inner join. 假设我想在Power BI的一个表中显示2维数据,正如您将在此处看到的那样,看来Power BI会执行错误的内部联接。

在此处输入图片说明

The First two columns (Prac_Number and ProjectTitle) come from a table A and the column "Name" from a table B, these two tables are connected trough another table C (which would be the fact table). 前两列(Prac_Number和ProjectTitle)来自表A,表“ B”来自表B,这两个表通过另一个表C(即事实表)连接。

to prove that what the power BI is doing, is wrong, I tried the following query with SQL Server: 为了证明Power BI的功能是错误的,我尝试使用SQL Server进行以下查询:

SELECT DISTINCT ph.ID as [PRAC_Number], ph.ProjectTitle, phs.Name

FROM pracHeader ph JOIN pracDetails pd ON ph.ID = pd.HeaderID 
                    JOIN pracHeaderStatus phs ON phs.ID = ph.StatusID

ORDER BY ph.ID

and it worked out pretty well as you can check see here: 效果很好,您可以在此处查看:

在此处输入图片说明

In other words, I just want to achieve this ^ in power BI. 换句话说,我只想在Power BI中实现此^。 So if I have to create a custom column or something like that, where should I create it?, in which table?... Because the data is not matching correctly. 因此,如果我必须创建一个自定义列或类似的内容,那么应该在哪里创建它?在哪个表中创建?……因为数据匹配不正确。 Thanks in advance! 提前致谢!

Reviewing the PowerBI output and your expected results, it looks like you might be missing (or something might not be correct with) the relationship configuration inside the PowerBI data model. 查看PowerBI的输出和预期的结果,似乎您可能缺少PowerBI数据模型中的关系配置(或某些东西可能不正确)。 PowerBI appears to just be listing the contents of each dimension table because it doesn't know how to relate the two. PowerBI似乎只是列出每个维度表的内容,因为它不知道如何将两者联系起来。 It could be helpful to see how you have your PowerBI relationships defined. 查看如何定义PowerBI关系可能会有所帮助。

PowerBI Relationship Pane PowerBI关系窗格

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM