Forum Discussion
Help with date subtraction with some criteria from different rows
- Anonymous11 months ago
Hi Stanford ,
Thanks for reaching out to Microsoft Fabric Community Forum.I have reproduced your scenario using Power Query and confirmed the behavior you described. The issue arises when referencing another task’s date, such as "Debug Setup," within the same Job #, particularly if task order varies or certain tasks are absent. To address this, I matched task names within a grouped query (grouped by Job #) instead of using row index. In the grouped table, I created a custom column that retrieves the "Task Must Start Date" for "Debug Setup" and assigns it as the "Task Req’d Date" for "Ready for Parts".
The custom code applied in the grouped step is :
let
taskTable = [AllTasks],
debugDate = try Table.SelectRows(taskTable, each [Task Description] = "Debug Setup"){0}[Task Must Start Date] otherwise null,
addReqdCol = Table.AddColumn(taskTable, "Task Req'd Date", each if [Task Description] = "Ready for Parts" then debugDate else null)
in
addReqdColThis method functions for each job, and if "Debug Setup" is not present, the "Task Req’d Date" will remain null as intended.
As shown below, the Task Req’d Date is populated only when "Debug Setup" exists within the same Job #:Please let me know if you have any questions or need further assistance.
Regards,
Sreeteja.
Thought I better explain that Row 1 and Row 2 really have nothing to with criteria. I need the "Task Description" to be what determines what to move and where to move it. If "Ready for Parts" then "Task Req'd Date" equals "Debug Setup" "Task Must Start Date".
Hi Stanford ,
Does every project always feature everyone of these tasks or is there a chance a certain project may be missing/not require one of these tasks?
Will these tasks always be required in this exact order, or is there a chance that tasks will get shifted round within the project?
Pete