Truncate Concatenated Value to No More than Two Decimal Places

I have an expression to calculate distance and convert to miles loaded in a virtual column. It takes the LATLONG of our office and the LATLONG of the address of whatever clinic is selected (done currently using an AwesomeSheet addon โ˜น๏ธ ) and sticks it in a virtual column. The expression is currently:

 

CONCATENATE(((DISTANCE([TKE Jackson],LATLONG([Latitude],[Longitude])))*0.621371),"mi")

 

How do I go about converting this so that it never displays more than two places past the decimal?

I initially thought about using LEFT() but that would yield slightly unpredictable results.  

Solved Solved
0 7 152
1 ACCEPTED SOLUTION

At first glance, seems like TEXT() should be enough:

CONCATENATE(
  TEXT(
    DISTANCE(
      [TKE Jackson],
      LATLONG(
        [Latitude],
        [Longitude]
      )
    )*0.621371
  ),
  "mi"
)

 

View solution in original post

7 REPLIES 7

A combination of LEFT()+RIGHT() should be the solution.

Can you explain the column type of each of the columns on the expression?

Sure!
[TKE Jackson] is a a LatLog type, 
[Latitude] and [Longitude] are both Decimal type

At first glance, seems like TEXT() should be enough:

CONCATENATE(
  TEXT(
    DISTANCE(
      [TKE Jackson],
      LATLONG(
        [Latitude],
        [Longitude]
      )
    )*0.621371
  ),
  "mi"
)

 

That works but i don't understand how ๐Ÿค”

Does TEXT() automatically truncate to two decimal places?

perfect, thank you so much!

Top Labels in this Space