Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
prakritnepal
Helper I
Helper I

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.

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi @prakritnepal 

Just use this logic to create a table

New table = FILTER(GENERATE('Table',CALENDARAUTO()),[Date]>=[start date]&&[Date]<=[end date])

 

and here is sample pbix file, please try it.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-lili6-msft
Community Support
Community Support

hi @prakritnepal 

Just use this logic to create a table

New table = FILTER(GENERATE('Table',CALENDARAUTO()),[Date]>=[start date]&&[Date]<=[end date])

 

and here is sample pbix file, please try it.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you. That worked

JarroVGIT
Resident Rockstar
Resident 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! 🙂





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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

Is startdate and enddate of type DateTime in your original table?




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.