I am struggling with the following issue. I have attached a sample qvw.
I have a simple table, which breaks down weekly stats for a team. I have a chart that has three dimensions, then does a sum of points. What I'm trying to add is a second expression that shows the player who had the maximum points for the given week.
I have used the FirstSortedValue function and it appears to work, but there is one week where it does not display the correct player.
In the attached, you will see the table and chart. I can't figure out why the function returns 'Timothy Wright' in week 7, when it should return 'Eric Ebron' because he had 14.9 pts vs 1.3 for Wright.
Perhaps I should be using an entirely different approach? Please keep in mind this is a small snapshot of the overall dataset, just to illustrate the issue. I have a set analysis built into the expression to show the function as it is in my actual qvw file (even though it is not needed for this small sample). Not sure if it makes a difference.
Thank you Ruben and Sunny, I didn't realize you could add multiple columns in the Aggr function. This fixed the issue I was experiencing, and uncovered another.
If I changed the data for wk 7, making the points equal for both Ebron and Wright. Now, the function comes back as NULL as it doesn't know which one to display. Could it be forced to pick one (perhaps based on the alpha sort on Player)?
Here is updated load script. I couldn't not repost the sample qvw. Chart now shows NULL for week 7.
load * inline
def, wk, pos, Player, pts
MIN, 1, TE, Vernon Davis, 4.7
MIN, 1, TE, Garrett Celek, 4
MIN, 1, TE, Vance McDonald, 0.5
MIN, 2, TE, Eric Ebron, 10.3
MIN, 3, TE, John Phillips, 3.5
MIN, 3, TE, David Johnson, 0.2
MIN, 4, TE, Owen Daniels, 6.9
MIN, 6, TE, Travis Kelce, 8.8
MIN, 6, TE, James O'Shaughnessy, 2.3
MIN, 6, TE, Demetrius Harris, 1.5
MIN, 7, TE, Eric Ebron, 7
MIN, 7, TE, Timothy Wright, 7