How to format calculated column number in Flow
-
17-02-2021 - |
Question
I am using a calculated column (number) in a SharePoint list, and putting the value into an email using a Power Automate Flow. The value will always be an integer.
When the value is passed through to Flow, it's converted to a string with a decimal point and 14 zero's added, so 7 becomes 7.00000000000000.
How can I format this to be an integer with no trailing decimal in Flow?
Solution
Use below formula:
formatNumber(int(outputs('<Get SharePoint Data Action Name>')?['body/<calculated column name>']), '0,0.00', 'en-us')
This will convert your calculated column to #,#.00
format (with 2 decimal points).
If you want the number without decimal points then you can use below formula:
formatNumber(int(outputs('<Get SharePoint Data Action Name>')?['body/<calculated column name>']), '0,0', 'en-us')
Replace Get SharePoint Data Action Name
and calculated column name
with your action name and calculate column name respectively.
You can convert the string to number in Microsoft flow using int function.
And You can format the number to desired format in Microsoft flow using formatNumber function.
Flow:
Output: