我们可以将两种措施合二为一吗?

时间:2018-04-27 19:46:06

标签: ssas powerbi dax ssas-tabular

我的数据视图如下所示:

enter image description here

按员工ID执行工资组的SUM我创建了2个度量如下:

Measure = MAXX(DISTINCT(Employee1[EmployeeId]),MAX(Employee1[Salary]))
SumSalary = SUMX(DISTINCT(Employee1[Salary]),[Measure])

我尝试如下,但它不起作用。在Power BI中显示错误的值。

SumSalary = SUMX(DISTINCT(Employee1[Salary]),MAXX(DISTINCT(Employee1[EmployeeId]),MAX(Employee1[Salary])))

还有其他方法可以合并这些措施吗?

1 个答案:

答案 0 :(得分:0)

我会尝试这些方法:

TotalSalary = SUMX(
                  SUMMARIZE(Employee1,
                      Employee1[EmployeeId],
                      "EmployeeSalary", MAX(Employee1[Salary])),
                  [EmployeeSalary])

首先按EmployeeId对它们进行分组,获取该ID的最高工资,然后将每位员工的工资加起来。