Forum Discussion

theitguy's avatar
theitguy
Helper I
8 years ago
Solved

Find Entries in Time Period

Hey,

 

I would like to measure a pretty easy thing, but at the moment I do not know how to start. I would like to calculate how many users haven't created any sessions in the first 30 days after they have been hired.

 

I have the following two tables:

Participants

Participant_IDNameDepartmentCodeHire_Date
1John Doe1234501-11-2017
2Max Mustermann1234501-11-2017
3John Smith1234501-11-2017
4Jan Janssen1234501-11-2017
5John Blow12345601-11-2017

 

 

Learning Sessions

Participant_IDLaunch_History_idLaunch_DateSeconds_Spend
12098416-11-2017444
12327116-11-201724
12327318-11-2017974
42097022-11-2017439
42330122-11-20171
52330205-12-2017221

 

As a result I would expect to see one user now, user with ID 3, because he has no sessions 30 days after his hire date.

 

Can anyone give me a hint how to start? :smileyhappy:

  • Seems like you would get 2,3 and 5 as not having any sessions. Regardless, you should be able to use EXCEPT function.

5 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Seems like you would get 2,3 and 5 as not having any sessions. Regardless, you should be able to use EXCEPT function.

    • theitguy's avatar
      theitguy
      Helper I

      Greg_Deckler

       

      You are absolutely right, I expect to get 2, 3 and 5.

       

      I had a look on EXCEPT. Is my consideration right that I need to do 2 steps?

      First, I will identify with EXCEPTwhich participants have no sessions at all

      EXCEPT(
      SELECTCOLUMNS(Learning_Results_Single_Sessions_sample;"Participant_ID";Learning_Results_Single_Sessions_sample[Participant_ID]);
      SELECTCOLUMNS(Participants_sample;"Participant_ID";Participants_sample[Participant_ID])

      Second,  I will do a UNION with the Participants_ID who had no sessions in their first 30 days of employment

      But I not know how to get these...

      I thought about using DATESINPERIOD but still I am struggling.

       

       

      • Greg_Deckler's avatar
        Greg_Deckler
        Community Champion

        I may be misunderstanding the data but I was thinking that if you did an EXCEPT on the ParticipantID columns from the two tables that you would have what you needed. But, again, I may not fully understand the entire data set.