Forum Discussion

ncl35's avatar
ncl35
New Member
8 years ago
Solved

Check if record from table A falls within a date range in table B without looping

Hello

 

I'm new to PowerBI and would like some advice whether it is possible to determine if a date from table A falls within two dates in table B.  Here is an example of the tables:

 

TABLE A:

 

STUDENTACADEMIC YEARCOURSEREGISTRATION START DATEREGISTRATION END DATE
S1232017C00105/09/201710/12/2017
S1232017C00202/11/201715/12/2017
S1232017C00113/01/201830/03/2018
S4562017C00101/09/201731/07/2018
S7892017C00110/09/201731/07/2018

 

 

TABLE B:

STUDENTACADEMIC YEARCOURSELOGIN DATEXX  ACTIVE REGISTRATION XX
S1232017C00110/09/2017YES
S1232017C00205/12/2017YES
S1232017C00109/01/2018NO
S4562017C00101/09/2017NO

 

So, I would like XX ACTIVE REGISTRATION XX to be determined by comparing the login date with and checks whether it falls within REGISTRATION START DATE and  REGISTRATION END DATE.

 

( I would concatenate STUDENT, YEAR and COURSE and loop at table A to check whether login date falls with registration start and end date)

 

Any advice or potential solution would be much appreciated.

 

Thanks

 

3 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity Champion

    My initial thoughts on this is that there is nothing that ties the 3rd rows together really in terms of checking if it falls within those particular dates versus, for example, the first row.

    • ncl35's avatar
      ncl35
      New Member

      Thanks for your prompt response.

       

      One possible logic I was thinking of was for each entry in TABLE-B I would loop at TABLE-A macthing on STUDENT, YEAR and COURSE and then an 'if statement' to check whether TABLE-B Login Date falls with the Regitration Start and End Date of TABLE-A.

       

      However, I can't see that I can apply that logic.