cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jessicabishop47
Helper I
Helper I

Convert string to currency with 2 decimal places

Hi,

 

I have a flow run from a selected sharepoint item. The sharepoint list uses a lookup column with numbers in it but converts to string in my flow.

 

I need to convert the string into currency with 2 decimal places only.

This is currently what I am getting from the flow: 

jessicabishop47_0-1653537849186.png

 

3 REPLIES 3
Rhiassuring
Community Champion
Community Champion

Hi there, 

 

Try this: 

 

formatNumber(float(variables('strInitial')),'C2','en-US')
 
(Mine is a variable, you'll want to use the output from your Compose, of course.)
 
C2 means Currency with 2 places, and en-US for the $. 
 
You can also do it this way:
 
 
Cheers,
 
Rhia

Hi @Rhiassuring ,

 

Thanks for that, could you show me as a flow?

 

I haven't created a variable before. I also have tried the other way but it didn't work.

Rhiassuring
Community Champion
Community Champion

You don't need to use a variable - you only need to replace the part of the expression I showed you with the output from where ever your number is coming from.

For example: 

 

formatNumber(float(variables('strInitial')),'C2','en-US')

 

The part in orange is the part that you will use Dynamic Content for. 

Dynamic Content is what we call the automatically created items that are available for use when you've used an action, like Get Item - like this:

Rhiassuring_1-1654008147202.png

 

 

To use the expression I've shown you, use a Compose action, then click the "Expression" tab. You'll see it to the right of Dynamic Content, above.

Highlight the part that I've shown you in orange (within where you've copied the expression), and backspace it.
Then, click on the Dynamic Content tab, and select the field that you want to apply to expression to. Then, click "OK". The expression will appear in a concatenated purple box in your compose, like this:

Rhiassuring_2-1654008198771.png
Now you can use the output of your Compose (shown in your Dynamic Content like this, in future actions: 

Rhiassuring_3-1654008240819.png

Whereever you need to - emails, to update another item, to add to a task - whatever.

If you are getting into using Power Automate, I'd recommend reading up on how to use variables and data operations - they will help you immensely in your journey, as they are used in pretty much every flow.  I find that Manuel T Gomes is a great source for this kind of foundations learning - here are some blogs for you to check out:

 

Variables...

https://manueltgomes.com/reference/power-automate-action-reference/set-variable-action/

 

An example of a Data Operation, "Compose"

 

https://manueltgomes.com/reference/power-automate-action-reference/compose-action/

 

You can see all the Data Operations by searching Data Operations when you go to add an action in flow, then just Google that action + Manuel T Gomes .. he seems to have something on everything. CC @manueltgomes 

 

Cheers,

 

Rhia

 

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (1,825)