Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear all,
Following is the schema of my data.
EmployeeID | Age | Consumption | Education | Gender | YearlyIncome |
I want to show EmployeeID, Age, Gender in different text objects who have highest YearlyIncome. Previously I have data (Sheet 1) where there was only one Max value. I solved this problem by using FirstSortedValue() function. But in the current data (Sheet 2) I've two EmployeeID which are sharing the same maximum YearlyIncome. Please find the attached data set and qvw application. I solved this issue by following two approaches. Here are they-
Approach1: Concat(If(Aggr(Sum(YearlyIncome),EmployeeID)=vMaxSal,EmployeeID),',')
Approach2: Concat( {1<EmployeeID=P({<YearlyIncome={$(vMaxSal)}>})>} EmployeeID,',')
vMaxSal: =Max(Aggr(Sum(YearlyIncome),EmployeeID))
Although I've already solved the problem but still I've the following questions:
1) Can this problem be solved by using FirstSortedValue() in UI ? If Yes then how, if not then why No?
2) Can this problem be solved by using FirstSortedValue() in script ? If Yes then how, if not then why No?
3) Which approach is most effective way for huge amount of data, Approach 1 or Approach 2 ?
Please find the app and data set and also I'm attaching script in notepad. Thanks in advance.
Regards,
Joy
One correction is needed.
=Concat(distinct Aggr(If(Sum({< Fakt = {'Fakt_A'}, Rok = {'2023'}>}Reg) = Max(total <Area> Aggr(Sum({< Fakt = {'Fakt_A'}, Rok = {'2023'}>}Reg), Area, Brand)), Brand), Area, Brand), ',')
Check your field names, year or Rok ?
You are right, @tresesco , thank you.