Forum Discussion

prakritnepal's avatar
prakritnepal
Icon for Helper I rankHelper I
6 years ago
Solved

cumulative counts of data points between two dates

I am having trouble figuring out how to calculate and display the number of people that were on vacation on any given day. 

 

I have a SharePoint list with all the data. The data I am trying to use is

1. start date

2. end date

3. person name

 

There are other columns as well that goes with regular vacation request like type, approved, etc.

 

Let's take the following example:

start dateend dateperson
12/15/201912/20/2019A
12/17/201912/22/2019B
12/19/201912/24/2019C

 

If we plot a bar graph, the number of people on vacation on 12/19/19 would be 3, all A B and C

12/17/19 would be 2,  B and A

12/16/19 would be 1, A

 

I was thinking of creating a calculated table but I have not been able to come up with a proper logic that works. Any help is appreciated.

5 Replies

  • JarroVGIT's avatar
    JarroVGIT
    Icon for Resident Rockstar rankResident Rockstar

    A calculated table will definitely help! It's a variation of a typical datetable:

    Table = ADDCOLUMNS(CALENDAR(MIN(Table1[startDate]), MAX(Table1[endDate])), "VacationPeople", COUNTROWS(FILTER(ALL(Table1), Table1[startDate] >= [Date] && Table1[endDate] <= [Date])))

     Table1 is a reference to your original table.

     

    Let me know if this works for you! 

     

    Kind regards

    Djerro123

    -------------------------------

    If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.

    Keep those thumbs up coming! 🙂

    • prakritnepal's avatar
      prakritnepal
      Icon for Helper I rankHelper I

      Thank you for the suggestion, for some reason the countrows piece is not working. I am getting blanks on all of those. 

      • JarroVGIT's avatar
        JarroVGIT
        Icon for Resident Rockstar rankResident Rockstar
        Is startdate and enddate of type DateTime in your original table?