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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / add new column with va...
Power Apps
Answered

add new column with value linked to existing column in a collection

(0) ShareShare
ReportReport
Posted on by 2

Hello everyone,

My need is to build a dropdown list with the last 52 weeks from the current week.

To do this I build a collection with a 'WeekStart' column like below : 

Set(currentMonday,DateAdd(Today(),1-Weekday(Today(),StartOfWeek.Monday),TimeUnit.Days));

ClearCollect(tempweekscol,
ForAll(Sequence(52,-51,1) As DD,
{
WeekStart: DateAdd(currentMonday,7 * DD.Value ,TimeUnit.Days)
}));


But now I am blocked I need to add new columns to this collection. 

One column named WeekEnd with Friday's List value : DateAdd(ThisRecord.WeekStart,4,TimeUnit.Days)
and
One column named WeekDisplay with Text value : Text(ThisRecord.WeekStart)&" - "&Text(ThisRecord.WeekEnd)

I tried do addcolumn :

Collect(weekscol,AddColumns(weekscol,"WeekEnd",DateAdd(ThisRecord.WeekStart,4,TimeUnit.Days),"WeekDisplay",Text(ThisRecord.WeekStart)&" - "&Text(ThisRecord.WeekEnd)))

but this formula doesn't work. In my opinion, my problem is linked to "ThisRecord.WeekStart" I don't know how I can call each item of my column to calculate others columns.

Thank you for your answer

Categories:
I have the same question (0)
  • Verified answer
    v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @Ez_ ,

     

    Please try:

    Set(currentMonday,DateAdd(Today(),1-Weekday(Today(),StartOfWeek.Monday),TimeUnit.Days));
    
    ClearCollect(tempweekscol,
    ForAll(Sequence(52,-51,1) As DD,
     With(
     {WeekStartData:DateAdd(currentMonday,7 * DD.Value ,TimeUnit.Days),WeekEndData:DateAdd(currentMonday,7 * DD.Value+4 ,TimeUnit.Days)},
     {
     WeekStart: WeekStartData,
     WeekEnd: WeekEndData,
     WeekDisplay:WeekStartData&"-"&WeekEndData
     }
     )
    )
    );

     

    Best Regards,
    Bof

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 426

#2
WarrenBelz Profile Picture

WarrenBelz 381 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 315 Super User 2026 Season 1

Last 30 days Overall leaderboard