The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
New Hires | Retirees | Total Workforce |
3 | 5 | 20 |
6 | 3 | 23 |
8 | 1 | 30 |
9 | 8 | 31 |
4 | 6 | 29 |
3 | 1 | 31 |
2 | 1 | 32 |
7 | 8 | 31 |
So in excel my first row = 22 +New Hires - Retirees
My second row = 20 (the result from the previous row) +NewHires - Retirees
My third row = 23 (the result from the previous row) +NewHires - Retirees
etc..
Tried various things including EARLIER, using indexing,
Solved! Go to Solution.
Now I got it. Please try
Total Workforce =
VAR StartingWF = 22
VAR TableBefore =
FILTER ( 'Table', 'Table'[Date] < EARLIER ( 'Table'[Date] ) )
VAR Change =
SUMX ( TableBefore, 'Table'[New Hires] - 'Table'[Retirees] )
RETURN
StartingWF + Change
Hi @Casperserven1
Is this a data table or a table visual? How did you get the first value (22)?
and this is the raw data.
@Casperserven1
Please refer to attached sample file with the proposed solution
Total Workforce =
VAR StartingWF = 22
VAR TableOnAndBefore =
FILTER ( 'Table', 'Table'[Date] <= EARLIER ( 'Table'[Date] ) )
VAR Change =
SUMX ( TableOnAndBefore, 'Table'[New Hires] - 'Table'[Retirees] )
RETURN
StartingWF + Change
Thanks the pbix worked perfectly, however when I tried the technique with other data this is what occurred...any ideas??
Thankyou so much , unfortunately it still isn't right. We only want the starting figure of 22 in the first row. after that is thould be adding and subtracting from the previous row.
yeah sure
Now I got it. Please try
Total Workforce =
VAR StartingWF = 22
VAR TableBefore =
FILTER ( 'Table', 'Table'[Date] < EARLIER ( 'Table'[Date] ) )
VAR Change =
SUMX ( TableBefore, 'Table'[New Hires] - 'Table'[Retirees] )
RETURN
StartingWF + Change
The first value (22) is the starting workforce.
User | Count |
---|---|
16 | |
8 | |
7 | |
6 | |
5 |
User | Count |
---|---|
25 | |
13 | |
12 | |
8 | |
8 |