Forum Discussion
#Duration function
- 4 years ago
This should do it
Add column > Custom column
[First Response Target] + #duration(0,0,[First Response Deviation in Minutes],0)
Examples:
First Response Target First Response Deviation in Minutes
------------------------ ----------------------------------------
4/4/19 -476
5/14/19 -1266
6/5/19 16934
6/13/19 814
7/2/19 -117001
Ah ok, the issue is because your durations go beyond 24 hours, see here
TIME function (DAX) - DAX | Microsoft Docs
DAX isn't ideal for this kind of thing, you would probably find it much easier to go back to using #duration and creating the column in Power Query. Is there a reason you need to do it in DAX?
- mattww4 years agoResponsive Resident
This should do it
Add column > Custom column
[First Response Target] + #duration(0,0,[First Response Deviation in Minutes],0)
- Anonymous4 years agoNot applicable
Matt,
Added the Custom Column using Power Query worked great.
Thanks,
Kevin
- Anonymous4 years agoNot applicable
Ok, I see the Time doesn't support the duration beyond 24 hours. I was using DAX because I was trying to replicate a report that was written in Tableau initially. Tableau uses this function for a calculated field to calculate the difference between the Date/Time Opened field and the First Response Target date field + the Deviation Minutes.
(DATEDIFF('minute',[Date/Time Opened],[First Response Target])
+ [First Response Deviation in Minutes]) / 60PowerBI DateDiff was giving me bad results when trying to do a similar thing:
_First Response (hours) = DATEDIFF('RowData'[Date/Time Opened],'RowData'[First Response Target] + 'RowData'[First Response Deviation in Minutes], MINUTE) /60
Thanks so much for your help. I will trying using the #duration function and creating the column using Power Query.
Kevin
- mattww4 years agoResponsive Resident
Ah yeah, the date functions in Power BI can be a bit fiddly compared to Tableau.
It would probably be possible in DAX if you really needed to, it would involve calculating the number of days, hours, minutes and seconds. It's probably not worth the hassle
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
Matt
- Anonymous4 years agoNot applicable
Thanks again Matt for your help. Once I figure it out using Power Query I will post the solution here.
- mattww4 years agoResponsive Resident
Hey Anonymous
Glad it worked, could you check you marked my reply (or Anonymous) as the solution, you've marked your own as a solution instead so it's displaying the wrong message in the thread
Good luck with the rest of your report
Matt