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

Format decimal numbers

How do i format decimal numbers in PowerApps? I saw how dates can be formatted...but nothing about formatting decimal numbers. Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Champion
Community Champion

https://powerapps.microsoft.com/en-us/tutorials/function-text/

 

If you scroll down 3/4 of the page, it has a section on decimals with examples--the output will be text though.

 

Text(5.678,"#.#") becomes 5.7

If you want to maintain 0, use Text(num,"0.0")

Microsoft Employee
@8bitclassroom

View solution in original post

9 REPLIES 9
Community Champion
Community Champion

https://powerapps.microsoft.com/en-us/tutorials/function-text/

 

If you scroll down 3/4 of the page, it has a section on decimals with examples--the output will be text though.

 

Text(5.678,"#.#") becomes 5.7

If you want to maintain 0, use Text(num,"0.0")

Microsoft Employee
@8bitclassroom

View solution in original post

Thanks, this put me on the right track, although I took me a while before I realized that I have to convert the (textual) value to a value before I format it as text again, i.e.

 

Text(Parent.Default,"[$-en-US]#.0") results in 2 with no decimals

 

Text(Value(Parent.Default),"[$-en-US]#.0") returns 2.0 with one decimal (even if the value is an integer).

 

Community Champion
Community Champion


@Beat wrote:

Thanks, this put me on the right track, although I took me a while before I realized that I have to convert the (textual) value to a value before I format it as text again, i.e.

 

Text(Parent.Default,"[$-en-US]#.0") results in 2 with no decimals

 

Text(Value(Parent.Default),"[$-en-US]#.0") returns 2.0 with one decimal (even if the value is an integer).

 


@Beat--I am glad you picked up on that

 

You might also like this method I use for getting a value if you do not like parentheses:

Text(Parent.Default*1,"[$-en-US]#.0")

 

Microsoft Employee
@8bitclassroom

Interesting, thank you! So you can multiply by 1 any string that can be converted to a number? Neat.

Frequent Visitor

Hi,

 

I am currently also trying to get rid of my decimals, but seem to be stuck.

 

I have a calculated value in minutes as a single line of text, based on two date/time entries.

 

=GANZZAHL(([Geplanter Einsatztermin Ende]-[Geplanter Einsatztermin])*1440)

The value in this example is 60 minutes, see first attachment, which looks as expected in the Sharepoint item.

 

Now when I pull this single line of text into my Powerapp, I get the "hostile" decimals (second screenshot) 🙂

 

I tried this:

 

Text(ThisItem.Geplante_x0020_Dauer*1; "[$-de-DE]#.0")

and

Text(Value(ThisItem.Geplante_x0020_Dauer); "[$-de-DE]#.0")

But end up only getting more dots in between all the 0s, but no matter what I try the 0 remain.

 

 

With this code:

Text(Value(ThisItem.Geplante_x0020_Dauer); "[$-de-DE]#")

I get rid of the dot after the "60", but also the 0s remain 😞

 

Any ideas?

Thanks a lot in advance!

 

 

. (period)Displays the decimal point in a number. Depends on the language of the custom format, see global apps for more details.

You need to adjust the format in function of what you're using as decimal separator in German locale.

If it is the comma, try "[$-de-DE]#,0" with a comma instead of a period.

First of all Thanks you verym much for Looking at my issue and soirry for the very late reply.

 

Following your idea I tried this:

 

Text(Value(ThisItem.Geplante_x0020_Dauer); "[$-de-DE]#,0")

And got this in return:

 

Geplante Dauer

600000000000000,0

 

So yes, the "." after the actual number is gone, but the comma shows at the very end after all those 0s.

Right now I guess I will ignore the 0s and shorten the field in lenght so it looks a tad better.

 

If you think of anything else I'd love to give it a try.

Cheers

 


@Bjoern_Jost wrote:

First of all Thanks you verym much for Looking at my issue and soirry for the very late reply.

 

Following your idea I tried this:

 

Text(Value(ThisItem.Geplante_x0020_Dauer); "[$-de-DE]#,0")

And got this in return:

 

Geplante Dauer

600000000000000,0

 

So yes, the "." after the actual number is gone, but the comma shows at the very end after all those 0s.

Right now I guess I will ignore the 0s and shorten the field in lenght so it looks a tad better.

 

If you think of anything else I'd love to give it a try.

Cheers

 


Try using Substitute function in order to convert "." to "," and vice versa.

 

 

 

Thank you @mr-dang, still helped me in 2020!

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (4,608)