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 / How to show week depen...
Power Automate
Answered

How to show week depending on current date?

(0) ShareShare
ReportReport
Posted on by 65

Hi all 

 

I have 2 tables. 1 is holding week 1-52 with 7 day splits between start date and end date, so in total we have 3 columns being used.

 

I am trying to display the current week in table 2 based on a user creating a record. So each time a user creates a record in this table, the current week is displayed next to their name. So this week we should be displaying week 8. 

 

Right now I have a 'list rows' action being used and connected to table 1. I am filtering the rows and using id eq 'WEEK-01' . This successfully displays 'week 1' in table 2 next to each user as they create a record. Although I want to display the current week instead. Would I have to create some sort of filter under 'list rows', 'filter rows' action? 

 

I am very new to flows so I appreciate any help! 🙂 

Categories:
I have the same question (0)
  • Mitanshu Profile Picture
    1,650 Moderator on at

    If you use following formula, it will give week number as 33 for 17-Aug

    add(div(dayOfYear(utcNow()),7),1)

     

    If you want to use your own SP List, then you can use ODATA Filter Query on your Week Definition Table using Get Items action

    StartDate ge 'utcnow()' and EndDate le  'utcnow()'

    happyume_0-1629181559491.png

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • Johns222 Profile Picture
    65 on at

    Hi @happyume 

    Thanks for that.

    And what kind of expression would I use for the 'add a new row' flow down below? To display the week?

    Thanks again 

    Right now I have this - 

    weeks.JPG

  • Verified answer
    Mitanshu Profile Picture
    1,650 Moderator on at

    Assuming

    • the Get Items method that I provided is working,
    • your WeekNumber is stored in the Title column,
    • your dates are structured so that my Get Items method will only give one row

    You can use 

    first(outputs('Get_items')?['body/value'])?['Title'] to get the value from your Title column

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If this post or my previous reply was useful in other ways, please consider giving it Thumbs Up.

  • Johns222 Profile Picture
    65 on at

    Hi @happyume 

    After I try first(outputs('Get_items')?['body/value'])?['Title'] 

    I receive the error below :

    The supplied reference link -- /weeks() -- is invalid. Expecting a reference link of the form /entityset(key).

  • Mitanshu Profile Picture
    1,650 Moderator on at

    Sorry, there is very limited information regarding the cause of your error.

    • What is the column type where you are trying to store the custom week number value -? Is it a Single line of text or a Choice column or a Number column?
    • Where are you providing weeks that is resulting in the error message? Are you getting error in Create Item or Update Item action for SharePoint, or somewhere else?

     

    After you Get Items (using ODATA filter query that I provided), can you create a Compose action and enter the expression I provided earlier: first(outputs('Get_items')?['body/value'])?['Title']

    Once done, can you please let us know if that gives you the desired custom week number for the current date? 

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If this post or my previous reply was useful in other ways, please consider giving it Thumbs Up.

  • Johns222 Profile Picture
    65 on at

    Hi @happyume 

    Thanks for your help. 

    1. It is a lookup column.

     

    Please ignore my message above. It turns out that adding weeks was not necessary. I took it out and now the flow runs fine but nothing is appearing in where I am trying to store the custom week value in

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 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard