Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I have this expression to return the top customer for the latest session who had the highest count of orders (Id) -
=only(if(aggr(Rank(
count(distinct {<SessionId={'$(LatestSession)'}>}Id)),
CustName)=1,CustName))
However today, we had 2 customers with the same top count of orders (i.e. rank 1) - in this scenario this function fails. How can I amend this function to return both top ranked customers?
Full macha rahe dono
I don't have the data to be to check this kushal, but I will take leap of faith
Right, Rank options ,1,1 might be better then. Maybe only the second argument is needed, if we do a numeric comparison:
=Concat(If(Aggr(Num(Rank(Count(Distinct {<SessionId={'$(LatestSession)'}>}Id)), 1),CustName)=1,CustName), ',')
or
=Concat(If(Aggr(Num(Rank(Count(Distinct {<SessionId={'$(LatestSession)'}>}Id))),CustName)<2,CustName), ',')
Haven't tested it, since my version seems to return different results than yours anyway.
May be this without Rank !
=Concat(Distinct Aggr(IF(Count({<SessionId={'$(LatestSession)'}>}Id) = Max(TOTAL Aggr(Count({<SessionId={'$(LatestSession)'}>}Id),CustName)), CustName),CustName),', ')
Manish bhai aapka hee intezar tha .
stalwar1 why do you need num ? And yes your one worked as well - maybe both work?
I don't think Num is required, but used it against safeguarding myself. You might not need it