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.
Hi,
Is there a way to show the total days, hours, minutes and seconds in a chosen month? I have a date table which is linked to my other tables.
E.g if i select November 2021,Total Days = 30, Total Hours = 720, Total Minutes = 43200, Total Seconds = 2592000
Thanks
Solved! Go to Solution.
Hi @yaman123 ,
Here are the steps you can follow:
1. Create measure.
Measure =
var _select=SELECTEDVALUE('Table'[Date])
var _startday=EOMONTH(_select,-1)
var _endday=ENDOFMONTH('Table'[Date])
var _day=
DATEDIFF(_startday,_endday,DAY)
var _hour=
DATEDIFF(_startday,_endday,HOUR)
var _minute=
DATEDIFF(_startday,_endday,MINUTE)
var _second=
DATEDIFF(_startday,_endday,SECOND)
return
_day&""&"Days" &" "& _hour&""&"Hours" &" "& _minute&""&"Minutes" &" "& _second&""&"Seconds"
2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @yaman123 ,
Here are the steps you can follow:
1. Create measure.
Measure =
var _select=SELECTEDVALUE('Table'[Date])
var _startday=EOMONTH(_select,-1)
var _endday=ENDOFMONTH('Table'[Date])
var _day=
DATEDIFF(_startday,_endday,DAY)
var _hour=
DATEDIFF(_startday,_endday,HOUR)
var _minute=
DATEDIFF(_startday,_endday,MINUTE)
var _second=
DATEDIFF(_startday,_endday,SECOND)
return
_day&""&"Days" &" "& _hour&""&"Hours" &" "& _minute&""&"Minutes" &" "& _second&""&"Seconds"
2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @yaman123 ,
Create a column for each with below code:-
Days:-
Days =
var dayy = EOMONTH(Days_calculation[Column1],0)
return DAY(dayy)
Hours:-
Hours = Days_calculation[Days] * 24
Minutes
Minutes = Days_calculation[Hours] * 60
Seconds = Days_calculation[Minutes] * 60
Now add month in a slicer and these columns in required visual you will get desired output.
Output:-
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
99 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
102 | |
87 | |
64 |