cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
khaledhikmat 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
mr-dang Community Champion
Community Champion

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 Community Champion
Community Champion

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 Advocate III
Advocate III

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 Community Champion
Community Champion

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 Advocate III
Advocate III

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
Frequent Visitor

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!

 

 

Highlighted
Beat Advocate III
Advocate III

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
Frequent Visitor

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
New Member

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
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Power Platform 2020 release wave 1 plan

Power Platform 2020 release wave 1 plan

Features releasing from April 2020 through September 2020

Top Solution Authors
Top Kudoed Authors
Users online (5,043)