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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
AndyValente
New Member

combine two number columns in new custom column

Hello, I am trying to combine the content of two columns containing number values.

=[hour] & ":" & [min]

doesn't work, as such operation is not allowed with number columns. I have looked around but was not able to find an answer, any advice? Thank you

1 ACCEPTED SOLUTION
MarcelBeug
Community Champion
Community Champion

You may want to get:

  • A time value: #time([Hour],[Min],0)
  • A duration: #duration(0,[Hour],[Min],0)
  • Texts with leading zeroes (e.g 01:05): Text.PadStart(Text.From([Hour]),2,"0")&":"&Text.PadStart(Text.From([Min]),2,"0")
Specializing in Power Query Formula Language (M)

View solution in original post

3 REPLIES 3
tjd
Impactful Individual
Impactful Individual

I don't think you can concatenate numbers.  Try converting Hours and Minutes to text type and then it should work.

MarcelBeug
Community Champion
Community Champion

You may want to get:

  • A time value: #time([Hour],[Min],0)
  • A duration: #duration(0,[Hour],[Min],0)
  • Texts with leading zeroes (e.g 01:05): Text.PadStart(Text.From([Hour]),2,"0")&":"&Text.PadStart(Text.From([Min]),2,"0")
Specializing in Power Query Formula Language (M)

Thanks, after solving the first issue, I was facing the problem of having the wrong hour and minute format in the end, so your code was really helpful.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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