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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Calculated Column in S...
Power Automate
Unanswered

Calculated Column in Sharepoint List with comma

(0) ShareShare
ReportReport
Posted on by 22

 Hi,

 

I have two Columns in SharePoint List called Value and Stock

 

Prob.jpg

 

Result column should be calculated using calculation column logic.

 

Values and Stock will always have the same number of commas. but there can be any number of commas.   So the solution should be smart enough to count number of commas and multiple value in right order.

 

Please how can I do this in Power Automate and pass it back to Sharepoint List?

 

Any help is much appreciated. I am new to Power Automate so please try to break it down.

 

Thanks a lot in advance.

Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,195 Most Valuable Professional on at

    Hi @MiltonK,

     

    I think this is achievable with a couple of supporting variables and split functions. 

     

    Below is an example of that approach.

     

    calculatestockagain.png

     

    1. Add a initialize variable, call it Count. Set the value to 0.

     

    inializevariablecount.png

     

    2. Add a second initialize variable of type integer, call it Result

     

    inializevariableresult.png

    3. Add a third initialize variable of type Array, call it ValueArray

     

    incrementvariablevaluearray.png

    4. Add a Get Items, Retrieve the Value stock items.

     

    getitemsvaluestock.png

     

    5. Add an apply to each. Use the value in the select an output from previous steps field.

     

    applytoeach_value.png

     

    6. Add a Set variable within the Apply to each action. Set the ValueArray variable by using this expression:

     

    split(items('Apply_to_each')?['Value'], ', ')

     

     

    setvariable_valuearray.png

     

    7. Add a second Apply to each action (calculate results), within the other Apply to each. Use the ValueArray variable for the select an output from previous steps field

     

    applytoeach_calculateresults.png

     

    8. Add an increment variable action with the second apply to each. Increment the Result variable by using the expression below.

    This expression uses a split function to get the separate values and uses the count variable to get the correct item via a variable index. It also a mul to multiply the value with the stock.

     

     

    mul(int(split(items('Apply_to_each')?['Value'], ', ')[variables('Count')]), int(split(items('Apply_to_each')?['Stock'], ', ')[variables('Count')]))

     

     

    incrementvariable_result.png 

     

    9. Add a second increment variable action. Increment the Count variable with 1.

     

    incrementvariable_count.png

     

    10. Place an update item action outside of the second apply to each action, but within the first apply to each action. Update the item with the result variable.

     

    updateitem_result.png

     

    11. Add a set variable action. Reset the Count with 0

     

    setvariable_resetcount.png

     

    12. Add a set variable action. Reset the Result with 0

     

    setvariable_resetresult.png

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard