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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
rfickes
Frequent Visitor

Binning Elements (Unique Client IDs) Based on Summation of Another Element (Hours of Service)

I will try to lay this out as clearly as I can.

 

I have a database where each row indicates a unique visit that a client received from a caregiver. Each visit includes important elements such as the duration of the visit, the date of the visit, and a client ID.

 

I need to pull out of this and get into a stacked bar histogram count of the number of clients in any given week who received 0.00 - 9.99 hours of care, 10.00 - 40.00 hours of care, and 40.01+ hours of care.

 

Binning the dates into weeks is obviously not difficult - create a group with a bin size of 7 days. However, I'm not sure how to create the bins for hours of care received, because the hours of care will have to be summed across multiple visits in a given week.

 

Any assistance would be greatly appreciated.

 


Sample Data: 

Visit IDClient IDDateHours
141/1/20182
211/3/20189
331/5/20183
421/7/201810
551/9/201810
611/11/20182
731/13/20184
851/15/201812
911/17/201810
1031/19/20189
1151/21/20183
1251/23/201812
1351/25/20183
1431/27/201812
1521/29/20188
1651/31/20185
1712/2/201811
1822/4/20188
1942/6/20186
2012/8/20189
1 ACCEPTED SOLUTION
jthomson
Solution Sage
Solution Sage

I'd look to go to Power Query and:

 

- assign each row a week number based on whatever periods you use

- from there, group the rows where the client ID and week number match, adding the total hours

 

It should then be a bit easier to get to the result you want

View solution in original post

1 REPLY 1
jthomson
Solution Sage
Solution Sage

I'd look to go to Power Query and:

 

- assign each row a week number based on whatever periods you use

- from there, group the rows where the client ID and week number match, adding the total hours

 

It should then be a bit easier to get to the result you want

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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