Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

aggr() ?

hi all,

i have the following situation: my db contains people. each person is suppose to work x hours per day. people work on different projects. internal and external projects.

example:

people table:

name
hours full day
John Smith8
Richard Oaks4

project table

week
project
project type
name
hours
13project AinternalJohn Smith40
13project AinternalRichard Oaks9,5
14project AinternalJohn Smith24
15project BexternalJohn Smith32
15project BexternalRichard Oaks12

Now, e.g. on a bar chart with project type as dimension i can easily show the hours spent on project types by sum(hours).

BUT: When i want to (on the same chart) show the days spent over project types - how would i do that ? What would the expression look like ? For John Smith a whole day consists of 8 hours. For Richard Oaks it consists of 4 hours. (Means: If john Smith spends 40 hours, he worked 5 full days. If Richard Oaks spends 40 hours, he worked 10 full days.)

Hope my problem is clear.

Thanks for some advise!

5 Replies
Not applicable
Author

A simple sum(hours/[Hours Full day]) should do the trick if you have this field defined.

swuehl
MVP
MVP

Try as expression in your chart something like

=sum(aggr(sum(hours) / [hours full day], project, name))

Not applicable
Author

No, because the correct result - for overall days worked (internal & external) would be:

John                     12 days

Richard           5,3 days

----------------------

                                        17,3 days

 

But the expression you suggested would lead to:

                              sum(hours/hours full day)

                              = (117,5 / 12) =  9,9

Not applicable
Author

My suggestion should work correctly if Hours per day is defined in the script and linked to the employee. It would not take the total sum of hours divide by the total sum of hours full day, but before summarizing each it would split the hours and divide by the employee that is linked full day hours.

If it is not defined in the script then you would need an if statement to pair the correct full day hours to each employee.

swuehl
MVP
MVP

I think Marc is right, his expression should be enough.