cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MJK
Helper III
Helper III

How to get the numbers after decimal point

Hi,

 

I need to get the number after decimal point. For example -

 

If a user enters a number in the textbox, say 8.45. I need to extract the number after decimal point i.e 45.

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

@MJK 

 

if you want to extract the value after decimal point then you can use split function

 

consider the value is 8.9 then we can do split(value,".") this will split the value based on . and will produce result 8,9 if I use last function then I will get value 9 last(split(value,"."))

 

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-split

 

if this information helps you with resolution, please consider giving a thumbs up and mark the solution as resolved.

View solution in original post

5 REPLIES 5
Drrickryp
Super User II
Super User II

Hi @MJK 

Text( 8.9, "#.00" ) results in "8.90"   The result will be shown in a label if the input text is 8.9.  Check this ref: https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-text  for more details about how to display significant digits in PowerApps.

@Drrickryp ,

 

Thanks for the reply, but as per your solution you are just converting from one decimal place to two decimal place.

If the number is 8.9 then I just need to know what is entered after the decimal point, in this case "9".

@MJK 

 

if you want to extract the value after decimal point then you can use split function

 

consider the value is 8.9 then we can do split(value,".") this will split the value based on . and will produce result 8,9 if I use last function then I will get value 9 last(split(value,"."))

 

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-split

 

if this information helps you with resolution, please consider giving a thumbs up and mark the solution as resolved.

View solution in original post

v-bofeng-msft
Community Support
Community Support

Hi @MJK :

Do you want to get the value after the decimal point?

I think the following two points need to be considered:

  • Get the number after the decimal point.
  • removes all “0” from the end of the string.

I used a combination of functions to solve this problem:

1\Add textinput control(TextInput4)

2\Add a label conrol:

Text:

 

Value(
    Last(
        Split(
            TextInput4.Text,
            "."
        )
    ).Result
) /*The number after the decimal point is obtained by split*// Power(
    10,
    Len(
        Last(
            Split(
                TextInput4.Text,
                "."
            )
        ).Result
    ) - Len(
        TrimEnds(
            Substitute(
                Last(
                    Split(
                        TextInput4.Text,
                        "."
                    )
                ).Result,
                "0",
                " "
            )
        )
    )
)/*Get the number of "0" at the end of the string*/

 

4.gif

Best Regards,

Bof

 

 

@v-bofeng-msft 

Thanks for the solution but I need the number as it is, without eliminating the "0"'s

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (69,380)