Number to 2 decimal places: Text function and Round function not working...

I have the following expressions for a virtual column.  I'm trying to get the numeric value to 2 decimal places.

Concatenate(TEXT(ROUND([Consumo Grande]*1000/(24*60*60)*100)/100)," L/S") *the ROUND and TEXT functions are essentially performing the same function....limiting it to 2 decimal places...

Concatenate(ROUND([Consumo Grande]*1000/(24*60*60)*100)/100," L/S")

And I've Tried:

Concatenate(TEXT([Consumo Grande]*1000/(24*60*60)," L/S") because the TEXT function limits it to 2 decimal places.

When I save a new record to test, it shows the value to 2 decimal places ("5.08 L/S"), then quickly changes it to a value with no decimal places...("5 L/S").

If I just have the Concatenate without TEXT or ROUND...I see a very long decimal number for a very short time, then it changes to a value with no decimal places...

The column is set to type Text

Solved Solved
0 6 1,646
2 ACCEPTED SOLUTIONS

Dividing an integer by an integer results in an integer. Change either dividend or divisor to a decimal to get a decimal result. Easy way here is to divide by 100.0 instead of 100.

Related:

Re: How to ROUND to whatever interval you want. - Google Cloud Community  

View solution in original post

Thank you Mark! I learned something new today. This one was strange, I read the decimal documentation and it matched up with what you said, but in practice I couldn't get it to work. In the end I had to change both the divident and last divisor into decimals to make it stop reverting. 

 

CONCATENATE(ROUND(DECIMAL([Consumo Grande])*1000/(24*60*60)*100)/100.0," L/S")

 

View solution in original post

6 REPLIES 6

This worked in my testing with [Consumo Grande] as Text or Number and the virtual column set as Text:

Concatenate(ROUND([Consumo Grande]*1000/(24*60*60)*100)/100," L/S")
to:
CONCATENATE(ROUND(NUMBER([Consumo Grande])*1000/(24*60*60)*100)/100," L/S")

 

Same thing happens for me:  The value with the decimal point shows up for 1-2 seconds, then the value shown returns to a number with no decimal points:

5.08 L/S for a one second, then back to 5 L/S...  the decimals dissapear...

It's like it's a problem with the UX, but I can't find it....

That is a strange one. I can't seem to reproduce it, so I'm not sure what would fix it. I would probably attempt to turn the virtual column into a real column, then remove the formula from the new column and use it in an Action that sets a value to a row of the new column. Set the Action as the Event action of the Tables' Form behavior. 

Dividing an integer by an integer results in an integer. Change either dividend or divisor to a decimal to get a decimal result. Easy way here is to divide by 100.0 instead of 100.

Related:

Re: How to ROUND to whatever interval you want. - Google Cloud Community  

Thank you Mark! I learned something new today. This one was strange, I read the decimal documentation and it matched up with what you said, but in practice I couldn't get it to work. In the end I had to change both the divident and last divisor into decimals to make it stop reverting. 

 

CONCATENATE(ROUND(DECIMAL([Consumo Grande])*1000/(24*60*60)*100)/100.0," L/S")

 

Oh right, I only noticed one division. Each time you divide you need to make sure one of them is a decimal.