cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
batmanMon
Helper III
Helper III

calculated column flow error

Hi, I built a couple of app already, but im pretty much new to flow. I created a calculated column test2 in SharePoint to count the days between two dates, which works perfect and looks like that:

=IF(ApprovedDate<>"",0,IF(SendForApprove="",0,IF(ISERROR(DATEDIF(SendForApprove,TODAY()-1,"d")),"",(DATEDIF(SendForApprove,TODAY()-1,"d"))+1-INT(DATEDIF(SendForApprove,TODAY()-1,"d")/7)*2-IF((WEEKDAY(TODAY()-1)-WEEKDAY(SendForApprove))<0,2,0)-IF(OR(AND(WEEKDAY(TODAY()-1)=7,WEEKDAY(SendForApprove)=7),AND(WEEKDAY(TODAY()-1)=1,WEEKDAY(SendForApprove)=1)),1,0)-IF(AND(WEEKDAY(SendForApprove)=1,(WEEKDAY(TODAY()-1)-WEEKDAY(SendForApprove))>0),1,0)-IF(AND(NOT(WEEKDAY(SendForApprove)=7),WEEKDAY(TODAY()-1)=7),1,0))))

 

I set it up as Number

Then, I tried to create a flow to send an email, if the number is for example bigger than 2. I have tried to use initialize variable and compose, but it didnt work. I have tried to follow some of the guidance from other posts, but it didint work for me. I would appreciate, if someone could have a look at point out, where I went wrong?1st.jpg2ndd.jpg3rdd.jpg

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Super User
Super User

Hi @batmanMon,

 

Just to validate. Do you have an apply to each loop? 

 

I think you are pretty close to the solution. Try and use the test2 dynamics value from the get items action and use an int function to convert it into an integer.

 

Add it within an apply to each loop like in the screenshot below. That apply to each loop can use the value output of your get items.

 

applytoeach_getitems.png

 

Hope this helps a bit?



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


View solution in original post

4 REPLIES 4
Expiscornovus
Super User
Super User

Hi @batmanMon,

 

Just to validate. Do you have an apply to each loop? 

 

I think you are pretty close to the solution. Try and use the test2 dynamics value from the get items action and use an int function to convert it into an integer.

 

Add it within an apply to each loop like in the screenshot below. That apply to each loop can use the value output of your get items.

 

applytoeach_getitems.png

 

Hope this helps a bit?



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


annajhaveri
Community Champion
Community Champion

@batmanMon , are you using a calculated column in filter query of Get Items action, then I think that is not possible, calculated columns are not support in filter query.

Regards,
Anna Jhaveri

If I have answered your question, please mark the post as Solved to help other users to identify the correct answer
If you like my response, please give it a Thumbs Up.
batmanMon
Helper III
Helper III

 

@annajhaveri, Thank you! I realized that calculated columns are not supported in filter query, hence I asked for help, as ive tried three different ways to make my flow to work, but couldn't figure out how. I attached 3 pictures in my question. I would appreciate, if you could help me with finding the solution.

 

@Expiscornovus , I have tried to add apply to each loop as per your screenshot, but i'm getting an error message as per picture. I would really appreciate, if you could have a look and tell me, where am I going wrong

 

4th.jpg

 

batmanMon
Helper III
Helper III

@Expiscornovus  I just realized what ive done wrong. I was working on Apply to each 3, so just corrected the formula to 'Apply_to_each_3' and it did work. I will delete the other rubbish trials, which didn't work. Thank you very much! You are a life saver!

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (4,095)