Forum Discussion
Fetch dates from Another table if it exists between them
12-pune
Code looks correct. how did you remove the date ? Did you apply formatting or remove in Power Query ?
Can you just paste the sample data in this reply box from Excel, just to verify there is no time components.
If you can paste this data from these two tables in a new Power BI and share with your formula, I can also check on that.
Fowmy
Yes, i have removed the time constraint from Power Query.
Iteration:
| beginDate | endDate |
| 1/5/2022 | 1/19/2022 |
| 1/5/2022 | 1/19/2022 |
| 1/18/2022 | 2/1/2022 |
| 1/19/2022 | 2/2/2022 |
| 1/31/2022 | 2/14/2022 |
| 2/2/2022 | 2/16/2022 |
| 2/2/2022 | 2/16/2022 |
| 2/2/2022 | 2/16/2022 |
| 2/15/2022 | 3/1/2022 |
| 2/16/2022 | 3/2/2022 |
| 2/16/2022 | 3/2/2022 |
| 2/16/2022 | 3/2/2022 |
| 3/2/2022 | 3/14/2022 |
| 3/1/2022 | 3/15/2022 |
| 3/1/2022 | 3/15/2022 |
| 3/1/2022 | 3/15/2022 |
| 3/2/2022 | 3/16/2022 |
| 3/2/2022 | 3/16/2022 |
| 3/2/2022 | 3/16/2022 |
| 3/2/2022 | 3/16/2022 |
| 3/2/2022 | 3/16/2022 |
| 3/2/2022 | 3/16/2022 |
| 3/2/2022 | 3/16/2022 |
| 3/15/2022 | 3/29/2022 |
| 3/15/2022 | 3/29/2022 |
| 3/16/2022 | 3/29/2022 |
| 3/16/2022 | 3/30/2022 |
| 3/16/2022 | 3/30/2022 |
| 3/16/2022 | 3/30/2022 |
| 3/16/2022 | 3/30/2022 |
| 3/29/2022 | 4/12/2022 |
| 3/29/2022 | 4/12/2022 |
| 3/30/2022 | 4/12/2022 |
| 3/30/2022 | 4/13/2022 |
| 3/30/2022 | 4/13/2022 |
| 3/30/2022 | 4/13/2022 |
| 4/13/2022 | 4/26/2022 |
| 4/12/2022 | 4/26/2022 |
| 4/13/2022 | 4/27/2022 |
| 4/13/2022 | 4/27/2022 |
| 4/13/2022 | 4/27/2022 |
| 4/13/2022 | 4/27/2022 |
| 4/13/2022 | 4/27/2022 |
| 4/13/2022 | 4/27/2022 |
| 4/26/2022 | 5/10/2022 |
| 4/26/2022 | 5/10/2022 |
| 4/27/2022 | 5/10/2022 |
| 4/27/2022 | 5/11/2022 |
| 4/27/2022 | 5/11/2022 |
| 4/27/2022 | 5/11/2022 |
| 4/27/2022 | 5/11/2022 |
| 4/27/2022 | 5/11/2022 |
| 4/27/2022 | 5/11/2022 |
| 5/10/2022 | 5/24/2022 |
| 5/11/2022 | 5/24/2022 |
| 5/11/2022 | 5/24/2022 |
| 5/11/2022 | 5/25/2022 |
| 5/11/2022 | 5/25/2022 |
| 5/11/2022 | 5/25/2022 |
| 5/11/2022 | 5/25/2022 |
| 5/11/2022 | 5/25/2022 |
| 5/11/2022 | 5/25/2022 |
| 5/24/2022 | 6/7/2022 |
| 5/24/2022 | 6/7/2022 |
| 5/25/2022 | 6/7/2022 |
| 5/25/2022 | 6/8/2022 |
| 5/25/2022 | 6/8/2022 |
| 5/25/2022 | 6/8/2022 |
| 5/25/2022 | 6/8/2022 |
| 5/25/2022 | 6/8/2022 |
| 5/25/2022 | 6/8/2022 |
| 6/7/2022 | 6/21/2022 |
| 6/8/2022 | 6/21/2022 |
| 6/7/2022 | 6/21/2022 |
| 6/7/2022 | 6/21/2022 |
| 6/8/2022 | 6/21/2022 |
| 6/8/2022 | 6/22/2022 |
| 6/8/2022 | 6/22/2022 |
| 6/8/2022 | 6/22/2022 |
| 6/8/2022 | 6/22/2022 |
| 6/8/2022 | 6/22/2022 |
| 6/8/2022 | 6/22/2022 |
| 6/22/2022 | 7/5/2022 |
| 6/22/2022 | 7/5/2022 |
| 6/22/2022 | 7/5/2022 |
| 6/22/2022 | 7/5/2022 |
| 6/21/2022 | 7/5/2022 |
| 6/21/2022 | 7/5/2022 |
| 6/22/2022 | 7/6/2022 |
| 6/22/2022 | 7/6/2022 |
| 6/22/2022 | 7/6/2022 |
| 6/22/2022 | 7/6/2022 |
| 6/22/2022 | 7/6/2022 |
| 6/22/2022 | 7/6/2022 |
| 7/6/2022 | 7/19/2022 |
| 7/6/2022 | 7/19/2022 |
| 7/5/2022 | 7/19/2022 |
| 7/6/2022 | 7/19/2022 |
| 7/6/2022 | 7/19/2022 |
| 7/6/2022 | 7/20/2022 |
| 7/6/2022 | 7/20/2022 |
| 7/6/2022 | 7/20/2022 |
| 7/6/2022 | 7/20/2022 |
| 7/6/2022 | 7/20/2022 |
| 7/6/2022 | 7/20/2022 |
| 7/6/2022 | 7/20/2022 |
| 7/20/2022 | 8/2/2022 |
| 7/20/2022 | 8/2/2022 |
| 7/19/2022 | 8/2/2022 |
| 7/20/2022 | 8/2/2022 |
| 7/20/2022 | 8/2/2022 |
| 7/20/2022 | 8/2/2022 |
| 7/20/2022 | 8/2/2022 |
| 7/20/2022 | 8/2/2022 |
| 7/20/2022 | 8/2/2022 |
| 7/20/2022 | 8/3/2022 |
| 7/20/2022 | 8/3/2022 |
| 7/20/2022 | 8/3/2022 |
| 7/20/2022 | 8/3/2022 |
| 7/20/2022 | 8/3/2022 |
| 7/20/2022 | 8/3/2022 |
| 7/20/2022 | 8/3/2022 |
| 8/3/2022 | 8/16/2022 |
| 8/2/2022 | 8/16/2022 |
| 8/3/2022 | 8/16/2022 |
| 8/3/2022 | 8/16/2022 |
| 8/3/2022 | 8/16/2022 |
| 8/3/2022 | 8/16/2022 |
| 8/3/2022 | 8/17/2022 |
| 8/3/2022 | 8/17/2022 |
| 8/3/2022 | 8/17/2022 |
| 8/3/2022 | 8/17/2022 |
| 8/3/2022 | 8/17/2022 |
| 8/3/2022 | 8/17/2022 |
| 8/3/2022 | 8/17/2022 |
| 8/17/2022 | 8/30/2022 |
| 8/17/2022 | 8/30/2022 |
| 8/17/2022 | 8/30/2022 |
| 8/17/2022 | 8/30/2022 |
| 8/16/2022 | 8/30/2022 |
| 8/17/2022 | 8/30/2022 |
| 8/17/2022 | 8/31/2022 |
| 8/17/2022 | 8/31/2022 |
| 8/17/2022 | 8/31/2022 |
| 8/17/2022 | 8/31/2022 |
| 8/17/2022 | 8/31/2022 |
| 8/17/2022 | 8/31/2022 |
| 8/17/2022 | 8/31/2022 |
| 8/31/2022 | 9/13/2022 |
| 8/31/2022 | 9/13/2022 |
| 8/31/2022 | 9/13/2022 |
| 8/31/2022 | 9/13/2022 |
| 8/31/2022 | 9/13/2022 |
| 8/31/2022 | 9/13/2022 |
| 8/31/2022 | 9/13/2022 |
| 8/31/2022 | 9/13/2022 |
| 8/31/2022 | 9/13/2022 |
| 8/31/2022 | 9/13/2022 |
| 8/31/2022 | 9/13/2022 |
Story Table:
| id | Sprint | Jira status | AlignBeginDate | AlignEndDate |
| 710 | Maliang 22PI2.3 | Closed | 3/2/2022 | 3/15/2022 |
| 711 | Maliang 22PI2.IP | Closed | 3/1/2022 | 3/14/2022 |
| 712 | MasterPO 22PI2.IP | Closed | 3/15/2022 | 3/16/2022 |
| 713 | MasterPO 22PI2.IP | Closed | 3/15/2022 | 3/16/2022 |
| 714 | Closed | 3/2/2022 | 3/15/2022 |
Begindate and End date in Story table are generated using below DAX logics:
BeginDate:
AlignBeginDate =
IF(Align_StoriesData[Jira status]="Closed",
MINX(FILTER(Iterations,Align_StoriesData[AlignEndDate]>=Iterations[beginDate] && Align_StoriesData[AlignEndDate]<=Iterations[endDate]),Iterations[beginDate]),
IF(Align_StoriesData[Jira status]<>"Closed" && Align_StoriesData[Sprint]<> BLANK(),LOOKUPVALUE(Iterations[beginDate],Iterations[Iterations],Align_StoriesData[Sprint]),
IF(Align_StoriesData[Sprint]=BLANK() && Align_StoriesData[Jira status]="IceBox",
Calculate(MAX(JiraSWSprints[start]),FILTER(JiraSWSprints,JiraSWSprints[Rank]=2)),
IF(Align_StoriesData[Sprint]=BLANK() && Align_StoriesData[Jira status]=BLANK(),
Calculate(MAX(JiraSWSprints[start]),FILTER(JiraSWSprints,JiraSWSprints[Rank]=1)),
IF(Align_StoriesData[Sprint]=BLANK() && NOT(Align_StoriesData[Jira status]) IN {"IceBox","Closed","Declined"},
Calculate(MAX(JiraSWSprints[start]),FILTER(JiraSWSprints,JiraSWSprints[Rank]=1))
)))))
End Date:
AlignEndDate =
IF(Align_StoriesData[Jira status]="Closed" && Align_StoriesData[Sprint]<> BLANK(),Align_StoriesData[Jira Resolution Date],
IF(Align_StoriesData[Jira status]="Closed" && Align_StoriesData[Sprint]= BLANK(),Align_StoriesData[Jira Resolution Date],
IF(Align_StoriesData[Jira status]<>"Closed" && Align_StoriesData[Sprint]<> BLANK(),LOOKUPVALUE(Iterations[endDate],Iterations[Iterations],Align_StoriesData[Sprint]),
IF(Align_StoriesData[Sprint]=BLANK() && Align_StoriesData[Jira status]="IceBox",
Align_StoriesData[PI EndDate],
IF(Align_StoriesData[Sprint]<>BLANK() && Align_StoriesData[Jira status]="IceBox",
LOOKUPVALUE(Iterations[endDate],Iterations[Iterations],Align_StoriesData[Sprint]),
IF(Align_StoriesData[Sprint]<>BLANK() && NOT(Align_StoriesData[Jira status]) IN {"IceBox","Closed","Declined"},
LOOKUPVALUE(Iterations[endDate],Iterations[Iterations],Align_StoriesData[Sprint]),
IF(Align_StoriesData[Sprint]=BLANK() && NOT(Align_StoriesData[Jira status]) IN {"IceBox","Closed","Declined"},
Calculate(MAX(JiraSWSprints[end]),FILTER(JiraSWSprints,JiraSWSprints[Rank]=1)))))))))
For some dates, we are getting invalid Story Begin Date, which we are discussing on this forum, we need to resolve this issue only.
Thanks for all help.