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

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
Super User
Super User

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

______________________________________________________________


Did this answer your question? Please mark it as the solution.
Did it contribute positively towards finding the final solution? Please give it a thumbs up.

I answer questions on the forum for 2-3 hours every Thursday!



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
Super User
Super User

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

 

 

______________________________________________________________


Did this answer your question? Please mark it as the solution.
Did it contribute positively towards finding the final solution? Please give it a thumbs up.

I answer questions on the forum for 2-3 hours every Thursday!



Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Users online (4,950)