Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
prees959
Creator II
Creator II

Calculate Average......

Hi,

I need to calculate the average productivity of a particular Day, Shift Type, Grade and Dept...

 

For example, I have a dataset :

 

DateDayGradeDeptShift TypeUnits Produced
01/01/2016Monday1ADay35
02/01/2016Tuesday2BAfternoon53
03/01/2016Wednesday4CNight24
04/01/2016Thursday2CAfternoon67
05/01/2016Friday3ADay35
06/01/2016Saturday3BAfternoon24
07/01/2016Sunday5CNight64
08/01/2016Monday1ADay64
09/01/2016Tuesday4CDay23
10/01/2016Wednesday6ADay26
11/01/2016Thursday2AAfternoon71
12/01/2016Friday5ANight15
13/01/2016Saturday7BAfternoon84
14/01/2016Sunday2CAfternoon43
15/01/2016Monday4CNight56
16/01/2016Tuesday6ADay32
17/01/2016Wednesday8CNight79
18/01/2016Thursday3ANight83
19/01/2016Friday4AAfternoon26
20/01/2016Saturday6CAfternoon83
21/01/2016Sunday8ADay23
22/01/2016Monday2CNight57
23/01/2016Tuesday3ANight24
24/01/2016Wednesday1ADay74

 

So I would need to show that, for example,  Grade 1 Staff in Department A on a Day Shift have an average production of 49.5 etc.  

Is there a way to calculate this as an expression?

Thanks,

 

Phil

 

12 Replies
sunny_talwar

How are you getting 49.5 for Grade 1, Dept A, & Shift Type Day? I see three rows with value 35, 64, and 74. And they total to be 175 and 175/3 = 57.67? What am I missing?
skamath1
Creator III
Creator III

Add the following expression in the measure

 

Avg( {$<[Shift Type] = {"Day"}  >} [Units Produced])

 

 

prees959
Creator II
Creator II
Author

Hi I also filtered on the day of the week 'Monday' ...
sunny_talwar

So, if you add Grade, Dept, Shift Type, & Day as dimension and Avg([Units Produced]) as your expression... it seems to give what you want

image.png

prees959
Creator II
Creator II
Author

Hi,  thanks for the reply.

 

What I need to show is if an introduction of a new Rota will improve Production based on the same Day, Grade, Dept, Shift  Type.  The new shift Rota will be marked from a point in time (in the below example 26/01/206):

 

DateDayGradeDeptShift TypeUnits ProducedShift Rota
01/01/2016Monday1ADay35A
02/01/2016Tuesday2BAfternoon53A
03/01/2016Wednesday4CNight24A
04/01/2016Thursday2CAfternoon67A
05/01/2016Friday3ADay35A
06/01/2016Saturday3BAfternoon24A
07/01/2016Sunday5CNight64A
08/01/2016Monday1ADay64A
09/01/2016Tuesday4CDay23A
10/01/2016Wednesday6ADay26A
11/01/2016Thursday2AAfternoon71A
12/01/2016Friday5ANight15A
13/01/2016Saturday7BAfternoon84A
14/01/2016Sunday2CAfternoon43A
15/01/2016Monday4CNight56A
16/01/2016Tuesday6ADay32A
17/01/2016Wednesday8CNight79A
18/01/2016Thursday3ANight83A
19/01/2016Friday4AAfternoon26A
20/01/2016Saturday6CAfternoon83A
21/01/2016Sunday8ADay23A
22/01/2016Monday2CNight57A
23/01/2016Tuesday3ANight24A
24/01/2016Wednesday1ADay74A
25/01/2016Thursday2CAfternoon40B
26/01/2016Friday4AAfternoon5A
27/01/2016Saturday6CAfternoon50B
28/01/2016Sunday2CAfternoon20B

 

So, is it possible to show that :

 

DateDayGradeDeptShift TypeUnits ProducedShift RotaProduction Difference
04/01/2016Thursday2CAfternoon67A 
25/01/2016Thursday2CAfternoon40B-40%

 

for the same Day, Grade, Dept & Shift Type Rota B is 40% less efficient??

I will also need to be able to roll this up into a single Indicator for the whole dashboard to show if Rota B is better or worse for productivity than Rota A (in a variable for example)?

Thanks for any advice/help!

 

Phil

 

sunny_talwar

I am not entirely sure I understand what you are doing here.... why are we only looking at just 2 rows from the data? Others need not be part of the required output or is this just an example?

Also, when you say whole dashboard to show if Rota B is better or worse.... how exactly do you combine them.... 1 - (Sum(ROTA = B)/Sum(ROTA = A)) or do you avg the individual differences?
prees959
Creator II
Creator II
Author

Hi,

Thanks for your reply.

I was showing two rows as an example...  I guess I need to average the differences between Rota A and Rota B.  Even if I just compare Grade Type that would be a great start... But if we can show across all dimensions then even better..

Regards,

Phil.

 

 

 

 

sunny_talwar

Is this what you intend to get?

image.png

Expression

=Aggr(If([Shift Rota] <> Above([Shift Rota]), Avg([Units Produced])/Above(Avg([Units Produced]))-1), Key, Date)

Where Key is a field created in the script like this

Day&Grade&Dept&[Shift Type] as Key
prees959
Creator II
Creator II
Author

Hi,  Thanks for replying to this.

 

This is almost there I think....  Maybe i was too literal with my sample dataset.  Most likely the Shift Rota B wont always come directly after its corresponding Shift A...  The data is probably more fluid.

 

Could the same formula be used without the Above function?? What I'm trying to say is Compare Key to Key where Key consists of Day + Grade + Dept + Shift Type + Shift Rota ?

 

Thanks again!

 

Phil