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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
mwen90
Helper III
Helper III

Automatically convert column data

Hi, 

 

Thanks for the help! I feel like this should be easy but I can't find the DAX. 

 

I have two columns (text) which display time like 12.25 and 13.50. I want to convert these automatically (as data comes in) so it display's in quarters so 12.15 and 13.30 so I can do time lost calculations. Ie. 13.30-12.15 = 1.15, so it's one hour and 15 lost. 

 

How do I convert these numbers?

 

Thanks for the help!

1 ACCEPTED SOLUTION
selimovd
Super User
Super User

Hey @mwen90 ,

 

as you said the time is text. So you can split it up and compare.

Try the following calculated column:

Time Bucket =
VAR vHours = LEFT( myTable[TimeColumn], 2 )
VAR vMinutes = RIGHT( myTable[TimeColumn], 2 )
RETURN
    SWITCH(
        TRUE(),
        vMinutes > 0 && vMinutes <= 15,
            vMinutes & ":" & 15,
        vMinutes > 15 && vMinutes <= 30,
            vMinutes & ":" & 30,
        vMinutes > 30 && vMinutes <= 45,
            vMinutes & ":" & 45,
            vHours + 1 & ":" & 00
    )

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @mwen90 

First, you need to change the two columns from integer format to time format .

Original data :

Ailsa-msft_0-1623305345278.png

Create calculated column :

time1 = FORMAT(TIME(TRUNC(Sheet1[Column1],0),(Sheet1[Column1]-TRUNC(Sheet1[Column1],0))*60,0),"")

time2 = FORMAT(TIME(TRUNC(Sheet1[Column2],0),(Sheet1[Column2]-TRUNC(Sheet1[Column2],0))*60,0),"")

The effect is as shown:

Ailsa-msft_1-1623305345278.png

Then calculated the diff between two time , and change the format .

diff time = FORMAT(Sheet1[time2]-Sheet1[time1],"hh:mm:ss")

The final result is as shown:

Ailsa-msft_2-1623305345279.png

I have attached my pbix file ,you can refer to it .

 

Best Regards

Community Support Team _ Ailsa Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

selimovd
Super User
Super User

Hey @mwen90 ,

 

as you said the time is text. So you can split it up and compare.

Try the following calculated column:

Time Bucket =
VAR vHours = LEFT( myTable[TimeColumn], 2 )
VAR vMinutes = RIGHT( myTable[TimeColumn], 2 )
RETURN
    SWITCH(
        TRUE(),
        vMinutes > 0 && vMinutes <= 15,
            vMinutes & ":" & 15,
        vMinutes > 15 && vMinutes <= 30,
            vMinutes & ":" & 30,
        vMinutes > 30 && vMinutes <= 45,
            vMinutes & ":" & 45,
            vHours + 1 & ":" & 00
    )

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.