Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi I have created a simple measure which calcs the total minutes between two dates but what I actaully need to do is calcualte the total minutes between the two dates excluding any Saturday or Sunday that may exist within the period.
It is proabbly simple solution but i just can't seem to get it.
Anyone know if there is a way I can do a similar calc but for networkdays only?
any help would be greatly appreaciated..
Age Since Created in Mins =
VAR _CreatedDateTime = SELECTEDVALUE( Table[Created_Date] )
VAR _RefreshDateTime = MAX( DBDateTime[DBDateTime] )
RETURN
DATEDIFF(
_CreatedDateTime ,
_RefreshDateTime ,
MINUTE
)
Solved! Go to Solution.
After spending way to much time looking at this today I found I just need to walk away and it came to me.
Here is how I resolved it if it may be of any help to anyone else.
VAR _CreatedDateTime = SELECTEDVALUE( Table[Created_Date] )
VAR _RefreshDateTime = MAX( DBDateTime[DBDateTime] )
VAR _MinsDiff =
DATEDIFF(
_CreatedDateTime ,
_RefreshDateTime ,
MINUTE
) --Total minutes of all datetime from first
VAR _DaysDiff =
DATEDIFF(
_CreatedDateTime ,
_RefreshDateTime ,
DAY
) --Total number of all days from first.
VAR _NetworkDaysDiff = NETWORKDAYS( _CreatedDateTime , _RefreshDateTime ) - 1 -- removing first day as network days counts all days I need to calc days from first day.
VAR _WeekendDays = _DaysDiff - _NetworkDaysDiff -- find the number of weekend days by subtracting network days from all days
VAR _WeekendMins = _WeekendDays * 1440 -- convert days to minutes
RETURN
_MinsDiff - _weekendMins
After spending way to much time looking at this today I found I just need to walk away and it came to me.
Here is how I resolved it if it may be of any help to anyone else.
VAR _CreatedDateTime = SELECTEDVALUE( Table[Created_Date] )
VAR _RefreshDateTime = MAX( DBDateTime[DBDateTime] )
VAR _MinsDiff =
DATEDIFF(
_CreatedDateTime ,
_RefreshDateTime ,
MINUTE
) --Total minutes of all datetime from first
VAR _DaysDiff =
DATEDIFF(
_CreatedDateTime ,
_RefreshDateTime ,
DAY
) --Total number of all days from first.
VAR _NetworkDaysDiff = NETWORKDAYS( _CreatedDateTime , _RefreshDateTime ) - 1 -- removing first day as network days counts all days I need to calc days from first day.
VAR _WeekendDays = _DaysDiff - _NetworkDaysDiff -- find the number of weekend days by subtracting network days from all days
VAR _WeekendMins = _WeekendDays * 1440 -- convert days to minutes
RETURN
_MinsDiff - _weekendMins
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 |
---|---|
54 | |
27 | |
23 | |
14 | |
11 |
User | Count |
---|---|
77 | |
63 | |
44 | |
17 | |
12 |