如何在PowerBI中将多个持续时间值加起来大于24小时 [英] How to sum multiple duration values that sum to greater than 24 hours in PowerBI
本文介绍了如何在PowerBI中将多个持续时间值加起来大于24小时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当度量结果大于24小时(例如125:23:33)时,我如何求和多个持续时间值(一天中不同的人)。
How do I sum multiple duration values (different people working in one day) when the results will be greater than 24 hours (e.g. 125:23:33) in a measure.
例如,这些是要添加的持续时间值:
For example these are some duration values to add:
13:33:55
20:44:23
15:31:11
推荐答案
您将需要使用以下dax代码创建新的快速测量列:
You will need to create a "New Quick Measure" column with the dax code below:
SumDuration =
VAR TotalSeconds=SUMX('MyTable',HOUR('MyTable'[duration])*3600+MINUTE('MyTable'[duration])*60+SECOND('MyTable'[duration]))
VAR Days =TRUNC(TotalSeconds/3600/24)
VAR Hors = TRUNC((TotalSeconds-Days*3600*24)/3600)
VAR Mins =TRUNC(MOD(TotalSeconds,3600)/60)
VAR Secs = MOD(TotalSeconds,60)
return IF(DAYS=0,"",IF(DAYS>1,DAYS&"days ",Days&"day"))&IF(Hors<10,"0"&Hors,Hors)&":"&IF(Mins<10,"0"&Mins,Mins)&":"&IF(Secs<10,"0"&Secs,Secs)
获得SumDuration后,可以在表上应用可视级别过滤(小于-大于)以显示或不显示你的前端。
After you get the SumDuration, you can apply Visual Level Filtering on your table (is less than - is more than) to show it or not on your front end.
这篇关于如何在PowerBI中将多个持续时间值加起来大于24小时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文