Forum Discussion

bdehning's avatar
bdehning
Icon for Post Prodigy rankPost Prodigy
4 years ago
Solved

convert numeric numeric number to whole number

I have column of numbers of years in decimal form 

.142

2.208

1.13875

4.03

3.96

 

How do I create column of numbers to get

<1 yr.

02 yr.

01 yr.

04 yr.

03 yr.

 

 

  • Hi bdehning ,

     

    Please create the new column.

     

    Column = 
    VAR _trunc =
        TRUNC ( 'Table'[Number] )
    RETURN
        IF ( _trunc < 1, "<1", FORMAT ( _trunc, "00" ) ) & " yr"

     

    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
    Best Regards,
    Winniz
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies

  •  I should have mentioned the decimal numbers could go as high as 60.  There are not just 5 rows of data.  

  • v-kkf-msft's avatar
    v-kkf-msft
    Icon for Community Support rankCommunity Support

    Hi bdehning ,

     

    Please create the new column.

     

    Column = 
    VAR _trunc =
        TRUNC ( 'Table'[Number] )
    RETURN
        IF ( _trunc < 1, "<1", FORMAT ( _trunc, "00" ) ) & " yr"

     

    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
    Best Regards,
    Winniz
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.