Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear all,
I need to display the most frequent event per week.
The data are weeks with dates on which a certain event (A,B,C,D) occurs.
My understanding was that I create a simple table with 'week' as dimension and the following expression:
=FirstSortedValue({$}Event, - aggr(count({$} Event),Event))
I figured that the dimension would work like the 'group by' in the manual, so that I count the number of a specific event per week, sorted it descending per week and get the string of the most frequent event.
Turns out that is works when I define a week but that it doesnt work when no week is selected.
Why and what would be the solution?
I attached a little example for illustration.
As always: Thanks for any help and for your interest,
Andreas
Maybe
=FirstSortedValue({$}Event, - aggr(count({$} Event),Week,Event))
Maybe
=FirstSortedValue({$}Event, - aggr(count({$} Event),Week,Event))
If you have ties in your count of events per week, you can also use something like
=Concat( Aggr(If( Rank(Count(Event),1) = 1,Event),Week,Event),', ')
to show all events with the same max count.
Stefan is there a way we can use Concat with FirstSortedValue?
Thanks Stefan,
I guess you can hear my 'AGGR !!' when you open your window.
Hi Sunny, not sure if I understand your question (wasn't there a similar question in a thread we both participated some weeks ago?), could you please elaborate?
You know how you used Concat with the Rank function to create more than one event (based on the count). I was wondering if we can somehow use the Concat with FirstSortedValue. I have tried doing this multiple times, but have never been successful. Is this something which is not possible to do, or am I missing something?
Hi Sunny,
I was referring to
Re: FirstSortedValue()_Multiple dimension values with same count
Something like this is what you are looking for?
I am unable to replicate your orginial Concat(...Rank..)) expression. What am I missing here?
=FirstSortedValue( Aggr(Concat(DISTINCT Event, ','), Week, Event),-Aggr(Count(Event),Week, Event))
Hi Sunny, you are referring the other thread's winning expression, right?
=FirstSortedValue( Aggr(Concat(DISTINCT EmployeeID, ','),YearlyIncome),-Aggr(YearlyIncome,YearlyIncome))
Note that the Concat() is already grouped by the ranking measure, something we would need to calculate (and that's hard to do in the aggr() dimensions...