我目前在使用 dax 时遇到了 power bi 矩阵计算的问题。我需要计算每两周加班的运行总数,这是我使用以下方法实现的
Lieu running total to Date = CALCULATE(SUM('Table1'[OT]),FILTER(ALLSELECTED('Calendar'[Date]),ISONORAFTER('Calendar'[Date], MAX('Calendar'[Date]), DESC)))
但是我现在需要计算超过 90 小时(额外 10 小时)的人数,我使用以下方法计算了超额时间 (OT)
Excess Lieu2 = IF([Lieu running total in Date]>=160,[Lieu running total in Date]-160,0)
问题是总计正在计算整个总数 - 160
最后几行以及总计的聚合不正确......非常感谢任何帮助。需要一个 Dax 解决方案,因为这将需要是动态的,因为将添加员工姓名
答案 0 :(得分:0)
使用以下代码添加一个新度量并将该度量添加到您的矩阵中。
Total_Lieu_running_total_to_Date =
SUMX (
SUMMARIZE (
table,//add the table from which the pay period end date is coming
table[pay period end date],//date column which you are using in matrix
"Lieu_running_total_to_Date",
[Lieu running total to Date] //measure which you using currently
),
[Lieu_running_total_to_Date]
)
注意:- 请添加一些示例数据,以便其他人快速为您提供解决方案。