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 / How can I sum up the t...
Power Automate
Answered

How can I sum up the total size of all attachments to an email message?

(0) ShareShare
ReportReport
Posted on by 4
 
Hi!
I'm trying to set up a flow to trigger on receipt of a new email message that has attachments.
I then want to total up the size of all the attachments to a GrandTotal variable.
Last step is to have it send a mobile notification if the GrandTotal exceeds 20 MB.
 
I have a When a new email arrives function with include attachments and only attachments checked.
Then, an initialize variable function for GrandTotal as int and value of 0.
Then, a for each function based on output from previous step of Attachments.
Then inside that, an increment variable function with parameter of Name = GrandTotal and the Value of 
add('TotalSize',int(item()?['size']))
Then a condition function with parameter of variables('GrandTotal') with the True result kicking off the Send me a mobile notification function.
 
The last time it ran, the flow told me the increment variable function failed because it was expecting the first parameter to be an integer, float, or decimal but the provided value is a String.
 
Suggestions welcome.
-R
I have the same question (0)
  • Verified answer
    rzaneti Profile Picture
    4,476 Super User 2026 Season 1 on at
     
    If I understood correctly, you are using the expression add('TotalSize',int(item()?['size'])) as input to the Increment variable. If this is correct, you might be using the Increment variable action wrongly. 
     
    As input for an Increment variable, you just need to pass the value to be added to a numeric variable. Take the following design as example, where we're adding the value from "Compose" formatted as integer to a numeric variable named "total" that was initialized as zero:
     
     
    After running the flow, the final value of "total" will be 5:
     
    I'm not sure about why you're using an add expression inside the action or passing the "TotalSize" as input, but feel free to clarify it if this is a part of the process. Also, if you need further support, please share some images of your flow design.
     
    Let me know if it works for you or if you need any additional help!
     
    If this solved your issue, please mark it as Accepted Answer.
    👍 If it helped, feel free to give it a like!

    🌐 Explore more Power Platform content on my Website or on my ▶️ YouTube
    💼 Find me on LinkedIn
     
  • RN-25022042-0 Profile Picture
    4 on at
    Thank you very much!
     
    This was helpful. Mostly in forcing me to think, rather than rely on copilot's suggestions. Looking back on it, I should have realized that the copilot suggestion was to basically bury an increment function inside the increment function. I stripped out the total variable and set it to increment based on the 
    @int(item()?['size']) value of the attachment size and it works fine now.
     
    -R

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 377

#2
11manish Profile Picture

11manish 279

#3
David_MA Profile Picture

David_MA 234 Super User 2026 Season 1

Last 30 days Overall leaderboard