Forum Discussion
Custom Sum for Date (measure) field
I have a measure that returns a date field in the following format
FORMAT(dateVal,"dd:hh:mm")
I need to SUM the total of the results in the measured field and show it in a Card
The requirement is to do the summation as 8 hours equal 1 day.
I didn't find a method to write a DAX for the Card
Is there any solution for my requirement?
Hi saranga,
According to the conditions you provided, I did the following test: created two measures, Duration measure is used to count the sum of time, and Day measure is used to count the number of days.
Best Regards,
HenryIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
4 Replies
- amitchandak
Super User
saranga , refer how to deal with duration and sum it up
https://radacad.com/calculate-duration-in-days-hours-minutes-and-seconds-dynamically-in-power-bi-using-dax
https://social.technet.microsoft.com/wiki/contents/articles/33644.powerbi-aggregating-durationtime-in-dax.aspx
https://www.pbiusergroup.com/communities/community-home/digestviewer/viewthread?GroupId=547&MessageKey=814a2cb4-3cca-4cd1-a620-c467adeaaaf6&CommunityKey=b35c8468-2fd8-4e1a-8429-322c39fe7110&tab=digestviewer
https://community.powerbi.com/t5/Quick-Measures-Gallery/Chelsie-Eiden-s-Duration/m-p/793639#M389 - v-henryk-mstf
Community Support
Hi saranga,
According to the conditions you provided, I did the following test: created two measures, Duration measure is used to count the sum of time, and Day measure is used to count the number of days.
Best Regards,
HenryIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- sarangaNew Member
Based on your solution, I prepare a measure as below. it works fine. thank you
ManDay =var TotalMin = SUMX(View_TicketEffort,View_TicketEffort[Effort])var Days = TRUNC(TotalMin/60/8)VAR Hors = TRUNC((TotalMin-Days*60*8)/60)VAR Mins = MOD(TotalMin,60)return IF(DAYS=0,"0days ",IF(DAYS>1,DAYS&"days ",Days&"day "))&IF(Hors=0,"00hours ",IF(Hors>1,Hors&"hours ",Hors&"hour "))&IF(Mins=0,"00mins ",IF(Mins<10,IF(Mins=1,"0"&Mins&"min ","0"&Mins&"mins "),Mins&"mins "))- v-henryk-mstf
Community Support