Hello Community 🙂
So im relly close now, to have what i need, but need a little help agian 😮
So this power automate plan is working, but how can i make it exclude the weekend, so my plans only comming in working day?. so if i start the script manuel sunday or sataturday its should start monday, and everytime is reach saturday or sunday in other month, its should still be monday. i read on the internet is possible, but can´t find the function i need O:O
here is the plan, if someone has a suggestion, plz let me know and ty ❤️
hi @ccc333ab :), omg it´s working O:O seems like it, i just tested it to 2023. relly ty for help i never self figured that if code out by me self ... <3.
ty to @fchopo and @tom_riha for helping me with starting this crazy planner script and ty to @ccc333ab for help me finish it ❤️ love the community her
I thought I saw in the original solution you were adding just 7 days, I see now you are adding a month. So we now need to update the bottom expression to also check for weekend. So in the last Set Variable will need this expression.
But because this expression is getting really big, going to add in a Compose Statement just to make this easier on my brain...
Compse Statement is just:
addToTime(outputs('Create_a_task')?['body/dueDateTime'],1,'month')
Set variable will now be:
if(equals(dayofWeek(outputs('Compose')), 0),addDays(outputs('Compose'), 1, 'yyyy-MM-dd'),if(equals(dayofWeek(outputs('Compose')), 6),addDays(outputs('Compose'), 2, 'yyyy-MM-dd'), outputs('Compose')))
hI @ccc333ab 🙂
Is ok i said ty for you try helping me but after i did what you said
its said now
Unable to process template language expressions in action 'Set_variable' inputs at line '1' and column '16855': 'The template language function 'addToTime' expects a timestamp as the first parameter, an interval as the second parameter, a time unit as the third parameter, and an optional format string as the fourth parameter. The function was invoked with '2' parameter(s). Please see https://aka.ms/logicexpressions#AddToTime for usage details.'.
and if i change my set variable to: addToTime(outputs('Create_a_task')?['body/dueDateTime'],1,'month'), then is correct. but its still make the plan on a satatur or sunday 😕
OH, I am SO sorry, that was really dumb of me. Goes to show you I should test before I submit a solution but wasn't really thinking when I submitted that.
Of course you can't refer to TaskDate in the initialize becuase it deosn't exist yet. So I forgot to just refer to utcNow date...which it origially set. This expression should now work.
if(equals(dayofWeek(utcNow()), 0),addDays(utcNow(), 1, 'yyyy-MM-dd'),if(equals(dayofWeek(utcNow()), 6),addDays(utcNow(), 2, 'yyyy-MM-dd'), utcNow()))
Hello @ccc333ab 🙂
something i do wrong ?, mabye something i miss ?, i get a error it said TaskDate' cannot be found.'.
OK, so I understand now. Go back to your original code that you had working before.
Now what I would do is only check your initial TaskDate is a Saturday or Sunday, and if it is, add 1 or 2 days to make it the Monday.
That should be the only thing you need to do because your original code just adds 7 to this date, which will then always be a Monday.
So your original initialize statement should read:
Where expresssion would be:
if(equals(dayofWeek(variables('TaskDate')), 0),addDays(variables('TaskDate'), 1, 'yyyy-MM-dd'),if(equals(dayofWeek(variables('TaskDate')), 6),addDays(variables('TaskDate'), 2, 'yyyy-MM-dd'), variables('TaskDate')))
Hello @ccc333ab
What im trying to do is this.
I have some workstuff, i need to do each month. The workstuff is all time the same, so i want to create a power automate, so it can create this plan for me for the nexst 1 year, so i dont need manuel create this in planner.
so the idea is, it need to create a plan for me each month for example nexst 12 month, and the plan must not reach a sataturday or sunday. i dont care what day is it as long is doenst reach a saturday or sunday. so i can see the plan for nexst 12 month.
i see microsoft come with the option first in november that long time to :/, but if this is not possible to do i just wait.
this is the script i got help from the begining before in time https://powerusers.microsoft.com/t5/Building-Flows/Help-how-can-i-create-a-power-automate-for-planner-to-show/m-p/802440#M111669
and its working fine for 1 week .
then i got a little help with this: https://powerusers.microsoft.com/t5/Building-Flows/Create-a-task-in-Planner-each-week-month-and-year/m-p/971681#M136030 and adapat the first link flow with the solution from secound link and its working now, but i need the last step, and make it to skip sataturday or sunday, and its working with your solution, but the problem is i cant get it to create for nexst 12 month now 🙂, its doing like you see on the picture from planner
im and we are so close to solve this crazy flow 😮
hope its make sense otherwise let me know, if you need i could take a screenshot of what i have now if you will take a look on it ❤️
Sorry, I must be missing something. Probably because I didn't see your previous post....so not 100% sure what you are trying to achieve.
What is it you are trying to do with the Apply_to_each? And what would your expected dates be in your task?
Hello , @ccc333ab 😉
Ty for help seems like it working, but now the count dont work , i mean it set 5 thing to my plan but everyone is same month look picture. if you want whole flow i can send here again. its should have set them diffrent month
I haven't seen your previous posts so I may not have the logic right, but if I understand this correctly, you are trying to create a task, that starts today, but if today is a Weekend, have it start on the following Monday instead.
Then you want to have the task end date be one month from now. But again, if the end date is on a weekend, have it in on the following Monday instead.
So my approach would be:
1. Using your start with setting the variable to today's date. Don't need to as I could just use utcNow() in all my expression, but this works as well.
2. I am now going to take this TaskDate and now check to see if it is a Saturday or a Sunday. If it is a Saturday I will add 2 days (to make it Monday). Likewise, if it is a Sunday I will add 1 day to it to make it a Monday.
And I'll do this also for 1 month from now. These are long expressions and I could have done this in multiple steps, and if you want me to I can show you to help explain these, but this will work if you just want to cut/paste.
Expression in TaskStart compose statement:
if(equals(dayofWeek(variables('TaskDate')), 0),addDays(variables('TaskDate'), 1, 'yyyy-MM-dd'),if(equals(dayofWeek(variables('TaskDate')), 6),addDays(variables('TaskDate'), 2, 'yyyy-MM-dd'), variables('TaskDate')))
Expression in TaskEnd compose statement:
if(equals(dayofWeek(addToTime(variables('TaskDate'),1,'Month')), 0),addDays(addToTime(variables('TaskDate'),1,'Month'), 1, 'yyyy-MM-dd'),if(equals(dayofWeek(addToTime(variables('TaskDate'),1,'Month')), 6),addDays(addToTime(variables('TaskDate'),1,'Month'), 2, 'yyyy-MM-dd'), addToTime(variables('TaskDate'),1,'Month','yyyy-MM-dd')))
Now you can just use these dates in your Planner Tasks.
Michael E. Gernaey
497
Super User 2025 Season 1
David_MA
436
Super User 2025 Season 1
Riyaz_riz11
244
Super User 2025 Season 1