Forum Discussion
secure_101
9 years agoFrequent Visitor
Bradford factor Calculation
Hello All, First time posting. For those of you unaware f the Bradford factor, it is a formula used to calculate a figure based on absenteeism S2 x D = B S is the total number of separat...
- 9 years ago
Thanks for that Simon.
Here is my suggested approach - uploaded with simplified data here:
https://www.dropbox.com/s/gt1jytqobrc9ilt/Bradford%20Factor.pbix?dl=0
- Add a Block Index column to your original table, so that Block Index has a different value for each block of consecutive days with the same value of Abs, across all ClockNos.
To do this, I carried out a series of steps in the Query Editor:- Sort the rows by ClockNo & Date
- Group the rows by ClockNo & Abs, using GroupKind.Local, which groups each consecutive block of ClockNo & Abs values.
- Add a Block Index column to the resulting grouped table.
- Re-expand the grouped rows, then tidy up.
- Create a Separate Absences measure, which is a DISTINCTCOUNT of Block Index where Abs="2".
- Create a Days Absent measure, which counts rows of the table where Abs="2".
- Create a Bradford Factor measure equal to [Separate Absences] ^ 2 * [Days Absent]
The measures in the end are:
Separate Absences = CALCULATE ( DISTINCTCOUNT ( 'Bradford Factor'[Block Index] ), 'Bradford Factor'[Abs] = "2" ) Days Absent = CALCULATE ( COUNTROWS ( 'Bradford Factor' ), 'Bradford Factor'[Abs] = "2" ) Bradford Factor = IF ( HASONEVALUE ( 'Bradford Factor'[ClockNo] ), // Only calculate for one ClockNo at a time, and don't aggregate ClockNos [Separate Absences] ^ 2 * [Days Absent] )Bradford Factor here doesn't aggregate ClockNos, but you could aggregate using AVERAGEX or some other method if you want.
Hopefully this does what you expect and can be applied to your data model.
Cheers,
Owen
- Add a Block Index column to your original table, so that Block Index has a different value for each block of consecutive days with the same value of Abs, across all ClockNos.
secure_101
9 years agoFrequent Visitor
Thanks Owen
Thats worked perfect
You're an absolute Star, couldn't have done it without you.
Thanks again
Simon
OwenAuger
Super User
9 years agoYou're welcome Simon, glad to have helped :)
It was quite an interesting problem to look at - a little out of the ordinary which piqued my interest!
Cheers,
Owen