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.
Hi
I'm trying to determine the running total of [hours/week] displayed by month/year. The basic algorithm is
RunningTotal = sum hours/week ( joined <= current and exit date is blank) + sum hours/week joined<= current period exit date > current period
I have a date dimension table with active relationship on joined, and inactive on exit.
I wasn't sure if this could be done in one or to measures
Here is some sample data
Staff ID | Name | Joined | Exit Date | BU | Hours Week | |
56894 | Zac | 5/05/2018 | Part Time | Sales | 40 | |
12454 | Jack | 3/06/2018 | Full Time | Sales | 33.75 | |
12071 | Jorda | 7/08/2018 | Full Time | Sales | 22.5 | |
45679 | Bee | 23/08/2018 | Part Time | Sales | 10 | |
12066 | Jane | 14/09/2019 | Part Time | Sales | 30 | |
12070 | Louise | 4/10/2019 | Part Time | Sales | 28 | |
12079 | Emme | 5/10/2019 | Full Time | Sales | 35 | |
12134 | Colin | 6/10/2019 | Contractor Full Time | Sales | 35 | |
12130 | Julia | 6/11/2019 | 23/11/2019 | Part Time | Sales | 30 |
12150 | Sophie | 7/11/2019 | Full Time | Sales | 35 | |
12147 | Megan | 8/11/2019 | 3/03/2020 | Full Time | Sales | 35 |
12169 | Rose | 9/11/2019 | Part Time | Sales | 33.75 | |
12180 | Abby | 10/11/2019 | Part Time | Sales | 22.5 |
and here is the expected outcome;
Expected Outcome | ||
Total Hours | ||
May | 2019 | 40.00 |
June | 2019 | 73.75 |
July | 2019 | 73.75 |
Aug | 2019 | 106.25 |
Sept | 2019 | 136.25 |
Oct | 2019 | 234.75 |
Nov | 2019 | 360.5 |
Staff Id of 12130 is excluded because they joined and left in the same month.
I can obtain the running total for the first condition (joined <= curr period and exit is null)
@Anonymous , refer if this HR blog can help
You seem to be on the right track. what has helped me is copious amounts of variables, breaking the problem into logical steps, and then using CONCATENATEX to validate the variables are actually doing what I want them to do for each of the steps.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
49 | |
26 | |
21 | |
16 | |
12 |
User | Count |
---|---|
57 | |
49 | |
44 | |
19 | |
18 |