简体   繁体   English

Power BI,具有两个条件的多个表的总和问题

[英]Power BI, issue on sum of several tables with two conditions

I struggle to find a way to sum columns of severals tables into one measure with two filters.我很难找到一种方法,将几个表的列加到一个带有两个过滤器的度量中。 To make it clearer, I have three tables as input (they have other columns that I hide as they have no purpose for this use case):为了更清楚,我有三个表作为输入(它们还有我隐藏的其他列,因为它们对这个用例没有任何用途):

Table 1表格1

Date        Currency    Amount
01/01/2020  USD         100
01/01/2020  EUR         50
02/01/2020  USD         200

Table 2表 2

Date        Currency    Amount
01/01/2020  USD         200
02/01/2020  USD         100
02/01/2020  EUR         100

Table 3表3

Date        Currency    Amount
01/01/2020  USD         50
01/01/2020  EUR         50
03/01/2020  EUR         100

I have no difficulties to do with one filter like date but I can't find a solution with two filters in order to have in results, a table in my dashboard that would display this:我对使用一个过滤器(如日期)没有任何困难,但我找不到具有两个过滤器的解决方案以便获得结果,我的仪表板中的一个表格将显示以下内容:

Date        Currency    Amount
01/01/2020  USD         350
01/01/2020  EUR         100
02/01/2020  USD         300
02/01/2020  EUR         100
03/01/2020  EUR         100

I don't find any solution, should I use a new table and aggregate columns in it?我没有找到任何解决方案,我应该使用新表并在其中聚合列吗? My three tables are linked by a relation on date but I can't add a relation for the Currency.我的三个表通过日期关系链接,但我无法为货币添加关系。 I'm a bit lost with what to do in Power Bi with this use case..对于这个用例在 Power Bi 中做什么,我有点迷失了。

Thanks in advance,提前致谢,

You can create a custom table using table 1, 2 and 3 as below.您可以使用如下表 1、2 和 3 创建自定义表。 Finally you can create your necessary Measures in the new "Custom_table" as per your requirement.最后,您可以根据您的要求在新的“Custom_table”中创建必要的度量。

custom_table = 
UNION(
    SELECTCOLUMNS(
        table1,
        "Date",table1[Date],
        "Currency",table1[Currency],
        "Amount",table1[Amount]
    ),
    SELECTCOLUMNS(
       table2,
        "Date",table2[Date],
        "Currency",table2[Currency],
        "Amount",table2[Amount]
    ),
    SELECTCOLUMNS(
        table3,
        "Date",table3[Date],
        "Currency",table3[Currency],
    "Amount",table3[Amount]
    )
)

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

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