cancel
Showing results for
Did you mean:
Frequent Visitor

## DropDown for week selection for the year

Hi,

I am trying to create a dropdown that will display the weeks (starting on Monday) of the year, but I cannot figure out the math calculation.

On start of the app I am using the Sequence function to create a global var for the dropdown items table as following:

//Collection of 52 Weeks

Set(weeksList,

ForAll(Sequence(52,

) - 182,  //This is 26weeks =(182days/7days)

7

),

Date(Year(Today()),Month(Today()),

Value

)

)

);

And for the dropdown the items property is:

For some specific dates eg:If the date is Jun 01 2021 the formula is not working correct

Can anyone help, I believe the problem is in my calculation OnStart where the sequence of 52 weeks (26past the current week Monday and 26 next weeks), that -182 it is wrong?

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support

Hi @atagios ,

``````ClearCollect(weeksList,
ForAll(Sequence(52,-26,1) As DD,
)
);``````

This formula simply get the date of current week's Monday then calculate the date of all the 52 weeks' Mondays.

Hope this helps.

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

3 REPLIES 3
Community Support

Hi @atagios ,

``````ClearCollect(weeksList,
ForAll(Sequence(52,-26,1) As DD,
)
);``````

This formula simply get the date of current week's Monday then calculate the date of all the 52 weeks' Mondays.

Hope this helps.

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

Frequent Visitor

Thank you, it seems that your suggestion is working!!!

Frequent Visitor

Hi @v-jefferni

I want only current months weeks in dropdown

``````Set(
weeksList,
ForAll(
Sequence(5,-3,1) As DD,
)
);``````

I have added this on OnStart of the App

It 's currently giving me correct outputs as wanted
Lists of 5 weeks: Like below

8/1/2022 - 8/7/2022

8/8/2022 - 14/8/2022

8/15/2022 - 8/21/2022

8/22/2022 - 8/28/2022

8/29/2022 - 9/4/2022

But in the next week :   It will give list as :

8/8/2022 - 14/8/2022

8/15/2022 - 8/21/2022

8/22/2022 - 8/28/2022

8/29/2022 - 9/4/2022
9/5/2022 - 9/11/2022

How can I restrict only current months week list ?