Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
Can someone please help me with a formula?
I have 2 tables
Hourentry:
LOAD * INLINE [
Project, Employee, Hours
A, Gerton, 8
A, Jeffrey, 6
A, Kim, 1
B, Jeffrey, 4
B, Mike, 5
];
Project:
LOAD * INLINE [
Project, Projectmanager
A, Gerton
B, Mike
];
Now I want a table with the following result
Employee | Project | Hours total | Hours from others on my project |
Gerton | A | 8 | 7 |
Jeffrey | A | 6 | 0 |
Jeffrey | B | 4 | 0 |
Kim | A | 1 | 0 |
Mike | B | 5 | 1 |
Total | - | 24 | 8 |
Especially the last column I find difficult:
- It should only display the hours on lines where the Employee is the project manager
- It should sum all hours for that specific project, except for the project manager himself
- Employee and project are the dimensions
- It should display the totals on the last row
How do I do that in Qlikview?
Thanks for helping,
Bart
Hi Bart,
here you go - see attached.
The "basic" expression that covers your logic should be:
if(Employee = Projectmanager, sum(total <Project>Hours) - sum(Hours), 0)
Only for Project Managers, get the total of Hours by Project and subtract the Hours spent by the Project manager himself.
However, this formula can only work at the detailed level (by Employee and Project). The total for this expression would be zero. So, it needs to be enhanced with the Advanced Aggregation function AGGR. This way, the results will be pre-calculated at the detailed level and then summarized for the total:
sum(aggr(
if(Employee = Projectmanager, sum(total <Project>Hours) - sum(Hours), 0)
, Employee, Project))
cheers,
Oleg Troyansky
QlikView Your Business: An expert guide to Business Discovery with QlikView and Qlik Sense
Hi Bart,
here you go - see attached.
The "basic" expression that covers your logic should be:
if(Employee = Projectmanager, sum(total <Project>Hours) - sum(Hours), 0)
Only for Project Managers, get the total of Hours by Project and subtract the Hours spent by the Project manager himself.
However, this formula can only work at the detailed level (by Employee and Project). The total for this expression would be zero. So, it needs to be enhanced with the Advanced Aggregation function AGGR. This way, the results will be pre-calculated at the detailed level and then summarized for the total:
sum(aggr(
if(Employee = Projectmanager, sum(total <Project>Hours) - sum(Hours), 0)
, Employee, Project))
cheers,
Oleg Troyansky
QlikView Your Business: An expert guide to Business Discovery with QlikView and Qlik Sense