Calculate difference between 2 (Two) dates in Power BI Power Query

preview_player
Показать описание
Learn how to calculate difference between 2 (Two) dates in Power Query of Power BI. In Power Query, calculate difference between 2 two dates or 2 column dates & show two 2 dates difference. You will get more videos like this in Power BI Power Query M Functions Tutorial Series @PettakaTechnologies
=========================================================
#tutorial #powerbi #pettakatechnologies #powerquery #mfunctions
=========================================================
****************Steps To Follow************************
1) Data source should contain two dates column.
2) Go to Power Query editor, select "Add Column" from tab.
3) Select "Custom Column" to add a new custom column.
4) "Add Custom Column" dialog box appears.
5) Rename you new "Custom Column"
6) Enter Power Query M Function "Difference.ToRecord" and select two columns.
7) Expand "Difference" Column to get date difference in days, hours, minutes & seconds.
========================================================
Learn Business Intelligence with Microsoft Power BI from Pettaka Technologies. Power BI Tutorial for Beginners 2020.
Power BI by Pettaka Technologies.
Data Cleaning with Power Query of Power BI.
Data Visualization with Microsoft Power BI.
=======================================================
Playlists:

==============================================================================
Connect with us:

Рекомендации по теме
Комментарии
Автор

Ready to level up your Power BI skills? ✅ Learn how to replace negative values with zero in Power Query. 💯

Check it out i'd love to hear your comments and let me know about what you think! Don't forget to like, subscribe, and hit the notification bell to stay updated on more Power BI tips and tricks.

PettakaTechnologies
Автор

Hi! Thanks for showing the use of Duration.ToRecord. I got it . However, people might confuse with column heading and DAX function Duration as both were similar. This is because, you have used the term "Duration" for column heading as well. Otherwise everything was perfect. Thanks again.

ashokalways
Автор

Hello, very good video. Thank you for that. But i have a question: In Your Video the first line hast 10 Days and 10 Hours and 24 Minutes and 6 second duration . But i want a column with just duration in (hh:mm:ss) . That means in your case 10 days*24 hours = 240 + 10 Hours = 250:24:06. I want a column which show me just the Duration in hours:Minutes:sekonds. I can not solve it, when its more then 1 day. Thank you.

bentatlim
Автор

Thank you for sharing,

can we use this function in direct query mode as well?

gauravvishawkarma
Автор

Hello, I have 2 columns that have hh:mm:ss, one is time of call, second is time of action. I was looking to create a measure to get the time taken to take action. - Is there a way to do that in the measure? I am unable to do that currently.

your method above is an alternative I will be trying though.

Thank you

JapjeetS
Автор

this formula worked for me and I appreciate your video very much, but for some reason, my record shows up as a negative. For example, I have a "start" column and an "End" column, and if I follow your formula, it displays the difference between start and end as a -4 or -5 or whatever the difference in days might be. Any idea why it displays this way? Do I perhaps need to convert the figure to some other format?

krgamman
Автор

Is there a way to display them in a single row? E.G 0D 3H 56M?

hanneskruger
Автор

I got little bit confused this example.
How days duration it's showing 10(1st row) and hours duration also 10.
Hope this is right or my understanding is wrong?

Veluavip
Автор

I created a simple table of two columns of dates and applied as you have demonstrated but have received this error message: Expression. Error: We cannot apply field access to the type Function.
Details:
Value=[Function]
Key=Date Resolved
Can you please assist in resolving.

chrisnaidoo
Автор

What happend if you have null in one date??? Give me error :(

BogdhanaMeneses
Автор

Why the output is in only day, Hour, Minute and Second..
If my requirement is in Year, Month then what to do?

rakkesh