web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Can you combine and If...
Power Automate
Answered

Can you combine and If and a Float

(0) ShareShare
ReportReport
Posted on by 7

Hello 

I have a form that is completed, which asked for budget for a number of elements. However sometimes not all elements will be needed therefore sometimes there is no data in the budget field. i.e. one time it could be Accom, 100, Rail, 50, Meals, 100. the next time it may be Car Hire 100, Meals 30, Mileage 100. 

 

I want to convert all the totals into currency format when I am inputting the results into a sharepoint list as it looks nicer. I have used a compose to convert the totals from a string to a float and then used the Format numbers. This works, however it fails when some of the total fields are missed because they are not needed. 

 

Therefore I think in my compose I need to put:

If (carhirebudget) not empty, then convert to a float 

However I am only just learning expressions and I can not get these to convert. I have managed to write the empty function and know it returns a true or false but then I cant get it to then convert the string to a float if not empty. 

 

I attempted this: 

If(empty(body('Get_response_details')?['rcarehirebudget'], '0', 'true', 'false' float(body('Get_response_details')?['carhirebudget'])))
but it states it is invalid 
 

Any help on this would be greatly appreciated 

Categories:
  • Verified answer
    manuelstgomes Profile Picture
    6,643 on at

    Hi @LornaB 

     

    Let's see if this works:

    1. The empty function only accepts one parameter and will return true or false.

    2. The if accepts 3. A condition that returns true or false (you have that in the previous one), the value for true, and the false value.

     

    Here's the formula:

    if(empty(body('Get_response_details')?['rcarehirebudget'],0,float(body('Get_response_details')?['carhirebudget']))

     

    So you check if it's empty. If it returns 0, otherwise converts it to a float.

     

    Can you please check if and let me know if you have any questions?

     

    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

    Cheers
    Manuel

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 425

#2
11manish Profile Picture

11manish 323 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 274

Last 30 days Overall leaderboard