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

Question: Format a Number from Sharepoint List into 2 decimal places and commas no matter the input number

I am currently building a flow where an HTML template document is being filled through a series of compose statements and replace expressions within them. They look as follows:

 

replace(outputs('Compose_-_Set_EndDate'), '{TotalCost}', string(body('Get_item')?['TotalCost']))

 

In this case the thing that is being replaced is the TotalCost token with the TotalCost item from the current iteration of an apply to each loop. 

 

The problem is that the Number is formatted to have commas and 2 decimal places in the SharePoint List, however, when it is converted into this Flow it loses the decimal places and commas. For example, 5,456.00 would change to 5456 in the flow and then output as such on the HTML document. I am dealing with these numbers as currencies so they need to be precise to 2 decimals.

Any help would be much appreciated. 

Thanks! 

1 ACCEPTED SOLUTION

Accepted Solutions

A solution I have found is to avoid formatting in Flow at all. Instead, I created a dummy column that holds the formatted number in a string. I used Text(TotalCost,"[$-en-US]$#,##0.00") as a calculated columnn for TotalCost and then used that string information in various places where I needed it. It would still be nice if this can be done in flow but for now I will mark this as a solution since it solved my problem. 

View solution in original post

5 REPLIES 5
Super User II
Super User II

If you could provide an expanded screenshot of your Flow and steps, and of any detailed error messages you're receiving we could likely better assist you.

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Community Support
Community Support

Hi @jaredt17 ,

 

Could you share the full screenshots of Flow configuration?

If you use int() function or an Integer type variable to store these values, it may lose decimal places and commas.

It is recommended to use float() function or a variable of type Float.

 

In addition, if the number after the decimal point is 00, you could use concat() function to add a decimal point and 00.

Like:

concat(replace(outputs('Compose_-_Set_EndDate'), '{TotalCost}', string(body('Get_item')?['TotalCost'])),'.00')

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

This sounds like a good solution. I am not storing the number in any variable it is coming straight from the sharepoint list which it is stored as a number on. 

Could you give an example condition that would check if the numbers after the .00 are missing or 0? 

 

Here is a screenshot as well...

2bcd3c513dccb348f2afdd7d65b1a5dd.png

 

Thanks!

 

A solution I have found is to avoid formatting in Flow at all. Instead, I created a dummy column that holds the formatted number in a string. I used Text(TotalCost,"[$-en-US]$#,##0.00") as a calculated columnn for TotalCost and then used that string information in various places where I needed it. It would still be nice if this can be done in flow but for now I will mark this as a solution since it solved my problem. 

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Top Solution Authors
Top Kudoed Authors
Users online (2,032)