Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Set Analysis using max and sum
Data:
Project Version Date Person Time
Sales, 1.1, 1/1/2011, John, 5
Sales, 1.1, 1/1/2011, James, 6
Sales, 1.1, 1/1/2011, John, 8
Sales, 1.2, 1/1/2011, John, 10
Sales, 1.2, 1/1/2011, James, 12
Sales, 1.2, 1/1/2011, James, 8
Demo, 1.1, 1/1/2011, Jim, 5
Demo, 1.1, 1/1/2011, Jim, 6
Demo, 1.1, 1/1/2011, Jim, 8
Demo, 1.2, 1/1/2011, John, 10
Demo, 1.2, 1/1/2011, James, 12
Demo, 1.2, 1/1/2011, James, 16
Sales, 1.1, 1/7/2011, John, 5
Sales, 1.1, 1/7/2011, Jim, 6
Sales, 1.1, 1/7/2011, Jim, 8
Sales, 1.2, 1/7/2011, John, 10
Sales, 1.2, 1/7/2011, James, 12
Sales, 1.2, 1/7/2011, Jim, 8
Demo, 1.1, 1/7/2011, James, 5
Demo, 1.1, 1/7/2011, James, 6
Demo, 1.1, 1/7/2011, Jim, 8
Demo, 1.2, 1/7/2011, Jim, 10
Demo, 1.2, 1/7/2011, James, 12
Demo, 1.2, 1/7/2011, Jim, 16
];
Hello,
Above is the data, from which I intend to do the following through set analysis.
Calculate the maximum time
Per Project, Per version, per date
For instance
Sales, 1.1, 1/1/2011, John, 5
Sales, 1.1, 1/1/2011, James, 6
Sales, 1.1, 1/1/2011, John, 8
Sales, 1.2, 1/1/2011, John, 10
Sales, 1.2, 1/1/2011, James, 12
Sales, 1.2, 1/1/2011, James, 8
For project sales, version 1.1 for 1/1/2011 John takes 13hrs (8+5) and James Takes 6hrs, so the max(sum(Time)) = 13
For Project Sales, version 1.2 for 1/1/2011 James takes 20hrs(12+8) and John takes 10 hrs, so max(sum(time)) = 20
How can I achieve the above? how can i calculate to get the 13, 20 from,the above two lines through set analysis?
Attached is a sample file where i was able to calculate the sum of time per person for each project,version. But i could not get the desired max value.
Question1 : can this be done in set analysis? how?
Question2 : Or should this be done only in load script? how?
If I understood the question, just put this around each of your expressions in the example you attached:
max(aggr(YourExpressionHere,"New Group"))
So for instance:
max(aggr(sum(Time),"New Group"))
Don't do it in the load script. QlikView is designed to do these kinds of aggregations quickly, and doing it in script instead will just make the whole application less flexible (and also be a lot of trouble).
If I understood the question, just put this around each of your expressions in the example you attached:
max(aggr(YourExpressionHere,"New Group"))
So for instance:
max(aggr(sum(Time),"New Group"))
Don't do it in the load script. QlikView is designed to do these kinds of aggregations quickly, and doing it in script instead will just make the whole application less flexible (and also be a lot of trouble).
Thanks for your help, after adding max(aggr .... as you have mentioned, I was able to get the desired result.