Forum Discussion

Kumar11109's avatar
Kumar11109
Helper IV
8 years ago
Solved

Days Gap For Each Group

Hi All, 

 

I want to find the gap between dates for each group. Sample data can be found here. 

 

Data

 

How will be able to do it. 

 

Thank You, 

 

  • Hi,

     

    This is the calculated column formula i wrote.  You may download my solution file from here.

     

    =if(ISBLANK(CALCULATE(MAX(Data[Session Date]),FILTER(Data,Data[GroupId]=EARLIER(Data[GroupId])&&Data[Session Date]<EARLIER(Data[Session Date])))),BLANK(),Data[Session Date]-CALCULATE(MAX(Data[Session Date]),FILTER(Data,Data[GroupId]=EARLIER(Data[GroupId])&&Data[Session Date]<EARLIER(Data[Session Date]))))

     

    Hope this helps.

     

6 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Kumar11109,

     

    Do you wish to calculate days between Latest and Earliest  Session Date for each group?

    • Kumar11109's avatar
      Kumar11109
      Helper IV

      No I want to calculate difference between each date for each group. 

    • Kumar11109's avatar
      Kumar11109
      Helper IV

      Ashish_Mathur, Do you mean the required result?  If yes, its already in the  sample data set. Remember this is just for three groups. Actual data size is much bigger. 

       

       

      • Ashish_Mathur's avatar
        Ashish_Mathur
        Super User

        Hi,

         

        This is the calculated column formula i wrote.  You may download my solution file from here.

         

        =if(ISBLANK(CALCULATE(MAX(Data[Session Date]),FILTER(Data,Data[GroupId]=EARLIER(Data[GroupId])&&Data[Session Date]<EARLIER(Data[Session Date])))),BLANK(),Data[Session Date]-CALCULATE(MAX(Data[Session Date]),FILTER(Data,Data[GroupId]=EARLIER(Data[GroupId])&&Data[Session Date]<EARLIER(Data[Session Date]))))

         

        Hope this helps.