Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
saranga
New Member

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?

1 ACCEPTED SOLUTION
v-henryk-mstf
Community Support
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.

v-henryk-mstf_0-1608891670569.png

v-henryk-mstf_1-1608891685518.png

v-henryk-mstf_2-1608891706735.png

Here is the sample pbix file.

 

Best Regards,
Henry

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-henryk-mstf
Community Support
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.

v-henryk-mstf_0-1608891670569.png

v-henryk-mstf_1-1608891685518.png

v-henryk-mstf_2-1608891706735.png

Here is the sample pbix file.

 

Best Regards,
Henry

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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 "))

Hi @saranga ,

 

I am honored to be able to help you.

 

Best Regards,

Henry

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.