Forum Discussion

DebbieK's avatar
DebbieK
Helper I
4 years ago

Iterating and comparing rows

I have a table of tasks assigned to different people, with set due dates, hours and priorities. I have previously processed these (in Visual Studio) to determine an order of works. This was done by

  1. Grouping tasks by person
  2. Ranking by due date
  3. Determining projected completion dates, based on the sum of the hours of tasks ranked above them, then
  4. Iterating the rankings from first to last and checking whether the due date was being met
  5. If yes no action was taken
  6. If no it was checked whether this task was a higher priority than the task ranked above, if so its rank was switched with the one above and projected end dates recalculated until it was either meeting due date or was not a higher priority than the task above (essentially moving it up the rankings).

I am new to PowerBI and am trying to follow the same logic but can't figure out how to iterate, with reference to other rows. Can anyone assist with the best way to approach this?

 

Sample data 

AssignedToIDDue DatePriority (999 = highest)WorkingDaysRemaining
51/08/20222005
61/08/20221005
75/08/20221007
710/08/20221004
613/08/20225005
515/08/202290010
615/08/20225005
520/08/20225005
730/08/20229002

 

Desired result

 

AssignedToIDDue DatePriority (999 = highest)WorkingDaysRemainingRankProjectedEndDateOntime
515/08/202290010115/08/2022Y
520/08/20225005222/08/2022N
51/08/20222005329/08/2022N
613/08/2022500518/08/2022Y
615/08/20225005215/08/2022Y
61/08/20221005320/08/2022N
75/08/20221007116/08/2022N
710/08/20221004222/08/2022N
730/08/20229002324/08/2022Y

8 Replies

  • Hi DebbieK ,

     

    I am honestly confused with the sample and expected results provided. The due dates don't match as well as the priorities. For ID5, the dates are all 1/8 in the sample data but they're different in the expected result except for one. The priority numbers are also different - {900,500,100} vs {900,500,200} 

     

     

    • DebbieK's avatar
      DebbieK
      Helper I

      Hi Danextian - thank you, and sorry for the mistake in the sample data, one of the due dates were wrong. I have now corrected this.

       

      Note in the sample data it is sorted by due date, in the output data it is grouped by ID and then sorted by rank. 

      • danextian's avatar
        danextian
        Super User

        Hello,

        Where can I find the hours?

        Determining projected completion dates, based on the sum of the hours of tasks ranked above them

         

        Also, how is the projected end date computed? I am assuming that it is 7 (x rank-1) days from rank1 project.