目标:
我要把每个国家的总数加起来。在下面的例子中。总数应该是200。但很明显,我得到了600美元。基本上,我需要每个客户id的总列中的值,并按国家分列。
形势:
我的模型有以下几个维度
+--------------+-------------+----------+-------------+------------------+
| country name | customer id | order id | Price_total | price before tax |
+--------------+-------------+----------+-------------+------------------+
| france | 123 | 11 | 200 | 59.99 |
| france | 123 | 11 | 200 | 35.99 |
| france | 123 | 12 | 200 | 109.99 |
+--------------+-------------+----------+-------------+------------------+输出应该是:
法国: 200
发布于 2019-06-18 17:38:10
基本上,您希望将表聚合为没有重复值的表,然后再进行和。
Total =
VAR Summary =
SUMMARIZE (
Table1,
Table1[country name],
Table1[customer id],
"Price", MAX ( Table1[Price_total] )
)
RETURN
SUMX ( Summary, [Price] )汇总表有一行,每个country name和customer id的唯一组合,并计算每个唯一组合的最大Price_total (而不是和)。然后遍历该表,并为该汇总表中的每一行添加Price。
https://stackoverflow.com/questions/56653937
复制相似问题