cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DCNehs
Post Patron
Post Patron

Currency and Percentage in body of email

I've searched through past posts and haven't quite found what I'm looking for however I've tried some of the suggestions.

 

I'm sending an email out after a proposal has been sent for approval.  This email is going to just notify a couple people that an approval has started with a few bits of information from the SP list.  I'm having an issue pulling the information from the calculated columns for the $ amounts and percentage.

 

Any suggestions so that this would show as $123,000, $125,000 and 1.62%?  As mentioned, I've tried a few things that I've found, but still ending up with below.  THANKS!

 

emailinfo.jpg

1 ACCEPTED SOLUTION

Accepted Solutions
tom_riha
Super User
Super User

Hello @DCNehs ,

Power Automate has formatNumber(...) expression which you could use. It expects the number as the first parameter and then the number format. 

formatNumber(number, 'format')

In your case you'll need format 'C' for the currency and format 'P' for the percentage. If you add a number to it, it'll define also how many decimal places you want, e.g. 'C0' is currency with 0 decimal places, 'P5' is percentage with 5 decimal places.

image.png

If you're interested you can find the list of all available formats here: Standard numeric format strings | Microsoft Docs

 



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

View solution in original post

6 REPLIES 6
tom_riha
Super User
Super User

Hello @DCNehs ,

Power Automate has formatNumber(...) expression which you could use. It expects the number as the first parameter and then the number format. 

formatNumber(number, 'format')

In your case you'll need format 'C' for the currency and format 'P' for the percentage. If you add a number to it, it'll define also how many decimal places you want, e.g. 'C0' is currency with 0 decimal places, 'P5' is percentage with 5 decimal places.

image.png

If you're interested you can find the list of all available formats here: Standard numeric format strings | Microsoft Docs

 



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]
DCNehs
Post Patron
Post Patron

@tom_riha aha, ok.  I had seen this mentioned in a different conversation and it didn't work but i think i figured out what was happening.  We were using a copy of someone else's list and they had text columns and I'll need to change them into number columns.  I also found a video that helped.

 

The only other issue I still have is that the % column is a calculated column and I'm having an issue with that.  It says it's looking for an integer or number and it technically is.  Will need to play with that a little more.

DCNehs
Post Patron
Post Patron

@tom_riha , I've tried several different scenarios and still cannot get the sharepoint column to show up correctly in the email.  Getting the following error:

 

Unable to process template language expressions in action 'Compose_2' inputs at line '1' and column '37726': 'The template language function 'formatNumber' expects its first parameter to be an integer or a decimal number. The provided value is of type 'String'. Please see https://aka.ms/logicexpressions#FormatNumber for usage details.'.

 

Is it because of how I have the calculated column set up?  Maybe it doesn't like calculated columns?

 

margin.jpg

 

calcmargin.jpg

Hello @DCNehs ,

Calculated column might be the problem, but you can move the formula directly in Power Automate, I suppose you've got all 3 columns from the formula available as a dynamic content so you can use them in an expression:

div(add(COSellPriceUSD,-COCostUSD),COSellPriceUSD)

Note:
all the values should be a dynamic content

And then format the result as a percent:

formatNumber(div(add(COSellPriceUSD,-COCostUSD),COSellPriceUSD),'P2')


[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

I apologize for being dumb here but I'm still a real beginner.  Having to learn really quick for a project and feeling completely stupid.  Am I doing that with a Compose?  I tried that as well as some type of variable but all come back as different errors.

Hello @DCNehs ,

you can do it in a Compose action or you can use the expression directly in an email. The important part is to use your dynamic contents in the expression, not the placeholder column names I used.



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (5,784)