cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
khaledhikmat
Level: Powered On

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
mr-dang
Level 10

Re: Format decimal numbers

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

8 REPLIES 8
mr-dang
Level 10

Re: Format decimal numbers

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

Beat
Level 8

Re: Format decimal numbers

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).

 

mr-dang
Level 10

Re: Format decimal numbers


@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
Beat
Level 8

Re: Format decimal numbers

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

Bjoern_Jost
Level: Powered On

Re: Format decimal numbers

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!

 

 

Beat
Level 8

Re: Format decimal numbers

. (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.

Bjoern_Jost
Level: Powered On

Re: Format decimal numbers

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

 

Hahanos
Level: Power Up

Re: Format decimal numbers


@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.

 

 

 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (6,103)