Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Building a Collection from multiple lines of data

(1) ShareShare
ReportReport
Posted on by 216 Super User 2025 Season 1

My issue today is working with a set of data that has the following format.

 

ProjectIDweekNumberpercentTime
2024-REQ-0012810
2024-REQ-001295
2024-REQ-001302
2024-REQ-0012715

 

What I need to do is have a collection by ProjectID that has columns for weekNumber and the percentTime in that field.  So it would look something like this.  Yes, I realize I will be building a line for each of the weeks of the year unless there are other thoughts.

ProjectIDweek28week29week30week27
2024-REQ-001105215

 

This is the code I wrote and it is not the desired results

 

ClearCollect(
 colTimeTracker,
 ShowColumns(
 AddColumns(
 TimeTracker,
 pTitle, Title,
 week28, LookUp(pmoTimeTracker, Title = TimeTracker[@Title] And weekNumber = 28, percentTime),
 week29, LookUp(pmoTimeTracker, Title = TimeTracker[@Title] And weekNumber = 29, percentTime),
 ),
 pmoTitle, week28, week29
 )
);

 

Maybe I am approaching this all wrong!  Any help is appreciated.


Glen

 

  • Verified answer
    Hack-7 Profile Picture
    216 Super User 2025 Season 1 on at
    Re: Building a Collection from multiple lines of data

    I was able to create a solution that worked.  Not sure if it was the best way to do it but it works.

     

    Here is a Snip of the code for reference if someone wants it:

    ClearCollect(
     colTimeList,
     AddColumns(
     GroupBy(TimeTracker, projectID, results),
     pm, LookUp(Projects, Title = projectID).pm,
     AFE, LookUp(CostObjects, projectID = projectID, costObject),
     ProjectDetails, LookUp(Projects, Title = projectID).projectTitle,
     week1, If(IsBlank(LookUp(results, weekNum = 1).percentTime), 0, LookUp(results, weekNum = 1).percentTime),
     week2, If(IsBlank(LookUp(results, weekNum = 2).percentTime), 0, LookUp(results, weekNum = 2).percentTime),

     I had to use the If() statement in each of the week#s since JSON to CSV does not like NULL values and not all of the fields had data.

  • developingteal Profile Picture
    392 on at
    Re: Building a Collection from multiple lines of data

    definitely use a collect, and then loop on it for each row, clear it whenever you need to. Clearcollect seems like it doesn't meet your needs/what you are trying to do 

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,635 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,997 Most Valuable Professional

Leaderboard