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
Applicable88
Impactful Individual
Impactful Individual

Add a string to a number or a decimal format

Hello,

I have a integer column, which is hours in decimal. I just watn to add a "h" for hours.

I know there is a possiblity to do something like

Measure=  containsstring(calculate(sum(Workinghours)), "h")

but this way I have convert the return of that measure into a string, which I cannot put in another calculation. Other than that the big disadvantage is that if I want to make color formatting the colors only applys to the sum of workinghours, but not to the string "h".

So my first question is, if its possible to do it without a measure in the first place, just format it in the "format" field in a certain way.

Or if not how to write better code to get there?

Thank you very much in advance.

 

Best. 

 

 

1 ACCEPTED SOLUTION
v-eqin-msft
Community Support
Community Support

Hi @Applicable88 ,

 

To my knowledge, currently there is no way to add a string to the Time type and still maintain the Time type.

 

In your case, I suggest you add an another measure to add a "h" text to the original measure. Like this:

sum Workinghours = CALCULATE(SUM('Table'[Workinghours]),ALLEXCEPT('Table','Table'[ID]))
Add H to measure = [sum Workinghours] & "h"

Then you could onditional formatting as well:

conditional formatting.PNG

 

An idea similar with what you expect has been submitted in the following link, please vote it up and you can add comments in this idea: Time format [hh]:mm:ss

 

 

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

View solution in original post

1 REPLY 1
v-eqin-msft
Community Support
Community Support

Hi @Applicable88 ,

 

To my knowledge, currently there is no way to add a string to the Time type and still maintain the Time type.

 

In your case, I suggest you add an another measure to add a "h" text to the original measure. Like this:

sum Workinghours = CALCULATE(SUM('Table'[Workinghours]),ALLEXCEPT('Table','Table'[ID]))
Add H to measure = [sum Workinghours] & "h"

Then you could onditional formatting as well:

conditional formatting.PNG

 

An idea similar with what you expect has been submitted in the following link, please vote it up and you can add comments in this idea: Time format [hh]:mm:ss

 

 

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

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!

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.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.