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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Getting x Hour x Minutes from 2 Period of date

Dear Team

 

I'm facing a problem,, as my table below.

Appreciate any help with dax

 

IMG_20210525_051445_758.jpg

Thanks you

SE

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thanks any respond

 

Good things is i solved my self .
i created 2 Column

Duration = Query1[LoadUnloadEndDateTime]-Query1[VehicleReportingDateTime]


and

X.Duration = IF(ISBLANK(Query1[DockName]),BLANK(),
    HOUR(Query1[Duration]) & " Hours and " & MINUTE(Query1[Duration]) &" Minutes")

 

Salam

SE

View solution in original post

9 REPLIES 9
Anonymous
Not applicable

Thanks any respond

 

Good things is i solved my self .
i created 2 Column

Duration = Query1[LoadUnloadEndDateTime]-Query1[VehicleReportingDateTime]


and

X.Duration = IF(ISBLANK(Query1[DockName]),BLANK(),
    HOUR(Query1[Duration]) & " Hours and " & MINUTE(Query1[Duration]) &" Minutes")

 

Salam

SE

v-shex-msft
Community Support
Community Support

HI @Anonymous,

You can use datediff function to calculate these two fields and get the difference of seconds.
Then you can do some math conversion on total difference seconds to transform them to hours and minutes and use corresponding characters to link them.

Duration =
VAR diff =
    DATEDIFF ( [Date1], [Date2], SECOND )
VAR _hour =
    INT ( diff / 3600 )
VAR _minute =
    INT ( MOD ( _hour, 3600 ) / 60 )
RETURN
    _hour & " Hours " & _minute & " Minutes"

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Anonymous
Not applicable

Thanks brother for ur respond .
but given dax only gv me Hours only and igonring the MInutes

parry2k
Super User
Super User

@Anonymous I clearly mentioned that column is added using PQ ( Power Query) not DAX



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Thanks anyway for ur respond brother

parry2k
Super User
Super User

@Anonymous solution was attached with my reply, download the pbix file and it has everything. 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Brother .

its not showing any dax but table with detail only

how can i used that if om not getting any dax

 

Thanks

parry2k
Super User
Super User

@Anonymous it is easier to do int PQ, see an attached solution. I created a sample table and added a column in PQ called Elapsed Time. You can tweak the solution the way you want.

 

Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS  I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Hi brother

 

can u help me on dax .
viewed your page, but cant found what i need

 

Thanks You

SE

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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