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 / Transpose Timesheet Co...
Power Apps
Unanswered

Transpose Timesheet Collection Data in Gallery

(0) ShareShare
ReportReport
Posted on by 53

Hi, 

Background & Solution:  Users are filling timesheet in ERP application weekly and data is stored in some database in the backend. The ERP system doesn't have timesheet adjustment feature (change the dates, hours or customer) therefore, team has to manually feed the data in system which takes a lot of their times.

 

We are developing a solution using PowerApp to automate this manual task. Data, we are getting directly from database table. Below is the schema. 

 

 

CustomerTimeTypeTimesheetDateHoursStartDate
C1A1/8/202281/8/2022
C2D2/8/202231/8/2022
C3C2/8/202251/8/2022
C4A3/8/202281/8/2022
C2A4/8/202251/8/2022
C3D4/8/202231/8/2022
C5SS5/8/202281/8/2022

 

I am trying to show the Data in below format. In header customer name and week days and dates (1-5). Customer column holds the customer name, day/ date column holds the hours. 

 

CustomerTimeTypeMon 01Tue 02 Wed 03Thu 04Fri 05
C1          A8    
C2          B 3 5 
C3         C 5 3 
C4      D  8  
C5A    8

 

I have managed to get the data in this format but having hard time to get the duplicate customers eliminated and set the hours accordingly. 

Any help would be highly appreciated. 

Categories:
  • v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @amanverma ,

     

    I made a sample for you.

    vxiaochenmsft_0-1660013085650.png

    vxiaochenmsft_1-1660013134826.png

    DropColumns(
     AddColumns(
     AddColumns(
     AddColumns(
     AddColumns(
     AddColumns(
     GroupBy(
     AddColumns(
     ShowColumns(
     LIST260,
     "Customer",
     "TimesheetDate",
     "Hours",
     "StartDate"
     ),
     "Num",
     Weekday(
     TimesheetDate,
     2
     )
     ),
     "Customer",
     "Test"
     ),
     "Mon 01",
     If(
     1 in Test.Num,
     Sum(
     Filter(
     Test,
     Num = 1
     ),
     Hours
     )
     )
     ),
     "Tue 02",
     If(
     2 in Test.Num,
     Sum(
     Filter(
     Test,
     Num = 2
     ),
     Hours
     )
     )
     ),
     "Wed 03",
     If(
     3 in Test.Num,
     Sum(
     Filter(
     Test,
     Num = 3
     ),
     Hours
     )
     )
     ),
     "Thu 04",
     If(
     4 in Test.Num,
     Sum(
     Filter(
     Test,
     Num = 4
     ),
     Hours
     )
     )
     ),
     "Fri 05",
     If(
     5 in Test.Num,
     Sum(
     Filter(
     Test,
     Num = 5
     ),
     Hours
     )
     )
     ),
     "Test"
    )

     

    DropColumns(AddColumns(AddColumns(AddColumns(AddColumns(AddColumns(GroupBy(AddColumns(ShowColumns(LIST260,"Customer","TimesheetDate","Hours","StartDate"),"Num",Weekday(TimesheetDate,2)),"Customer","Test"),"Mon 01",If(1 in Test.Num,Sum(Filter(Test,Num=1),Hours))),"Tue 02",If(2 in Test.Num,Sum(Filter(Test,Num=2),Hours))),"Wed 03",If(3 in Test.Num,Sum(Filter(Test,Num=3),Hours))),"Thu 04",If(4 in Test.Num,Sum(Filter(Test,Num=4),Hours))),"Fri 05",If(5 in Test.Num,Sum(Filter(Test,Num=5),Hours))),"Test")

    Best Regards,

    Wearsky

  • amanverma Profile Picture
    53 on at

    Hi @v-xiaochen-msft - Thank you very much for the code. 

     

    At this stage, I have already completed the task using a different method, however, i believe your approach is better than mine. 
    I am guessing, once i have this code on my Gallery.Items, all i have to do is call "Mon 01",  "Tue 02"......"Fri 05" on hour fields?

     

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 221 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 188 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 120

Last 30 days Overall leaderboard