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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
smp45
Regular Visitor

Incremental count/running total based on max in department

Hi

 

I have a table as follows, which shows by date and hour

  • the number of patients admitted,
  • number of patients discharged ,
  • the difference between them (admittedpts (3) - dischargedpts (4) = (-1) net. 

There are a total of 65 patient in beds at 12midnight

smp45_2-1637155796580.png

 

 

I need to calculate a running total (add/take the net difference from the next hour's pts count) based on each hour. e.g. for 00:00-00:59 , 3 patients were admitted and 4 discharged which taken from 65 gives 64

so

    for 02:00-02:59 the number of patients should be (64+3admitted)=67,

    for 03:00-03:59 the number of patients should be (64+3admitted+1admitted) =68 patients

    for 04:00-04:59 the number of patients should be (64+3admitted+1admitted+ 2admitted) =70 patients

 

easy enough to do in excel, but in power bi 9bit more difficult) any help apprecited

 

2 REPLIES 2
v-xiaoyan-msft
Community Support
Community Support

Hi @smp45 ,

 

I'm not quite sure if I understand your needs accurately.
Sample data without sensitive information and expected output would help tremendously.
Please see this post regarding: How-to-provide-sample-data-in-the-Power-BI-Forum 

 

Hope it helps,


Community Support Team _ Caitlyn

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

Hi

 

I have 2 tables , Table A holds the number of admissions and discharges by Date and hour

                           Table B Holds the number of patients in a bed at 12 midnight (this is a static number)

 

As we go on during the night and day, new patients will be admitted and some existing patients will be discharged.

 

What i require is a running total each hour that takes into account the number admitted and discharged by hour

 

here is a screen shot of the data.

Table A

DateHour_AHour BandAdmitDischargesNet
12/11/2021000:00-00:59440
 101:00-01:59110
 202:00-02:59413
 303:00-03:5945-1
 404:00-04:59211
 505:00-05:59422
 606:00-06:5923-1
 707:00-07:59312
 808:00-08:594 4
 909:00-09:59110
 1010:00-10:59330
 1111:00-11:592 2
 1212:00-12:59 3-3
 1313:00-13:5945-1
 1414:00-14:59413
 1515:00-15:592 2
 1616:00-16:59431
 1717:00-17:5924-2
 1818:00-18:59 8-8
 1919:00-19:5959-4
 2020:00-20:59211
 2121:00-21:59615
 2222:00-22:5946-2
 2323:00-23:59523
13/11/2021000:00-00:5923-1
 101:00-01:5914-3
 202:00-02:59422
 303:00-03:593 3
 404:00-04:59321
 505:00-05:59220
 606:00-06:59110
 707:00-07:591 1
 808:00-08:594 4
 1010:00-10:59 2-2
 1111:00-11:5945-1
 1212:00-12:59110
 1313:00-13:5934-1
 1414:00-14:594 4
 1515:00-15:5912-1
 1616:00-16:5913-2
 1717:00-17:59321
 1818:00-18:5938-5
 1919:00-19:5926-4
 2020:00-20:59624
 2121:00-21:5934-1
 2222:00-22:59514
 2323:00-23:59220

 

 

 

Table B

DateHourHour_ANumberOfPatients
12/11/202100:00:00062

 

The desired result i.e - running total

smp45_1-1637689523910.png

 

hope this makes it clear

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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