Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
vinieme12
Champion III
Champion III

Aggr Level without variable; any other ideas?

Hi

I will try to explain what I am trying to do with a sample attached.

I'm trying to evaluate rank based on either product category or the rank of the Product

Example in the Snapshot I've selected Product D1 and the rank for the same is "6"

but I've achieved that using  a variable to identify the AGGR level

my expression

Expression:  aggr(rank(sum({1}Amount)),$(vAggrLevel))

vAggrLevel  =if(GetSelectedCount(Level2)>0,'Level2','Level1')


Can we do this without using the variable? directly in the expression??

rank_aggr.PNG

Thanks

Vineeth

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
14 Replies
marcus_sommer

I doubt that $Field could be useful here because you will furthermore need any checkings if there is any selection anywhere. The if-loop itself might be replaceable with a pick(match()) and also there might be ways to create such a expression-statement with a kind of string-loop. But I think it won't make your task easier - rather the opposite will happens.

Why not just copying the if-checking within a variable ten times beneath eachother ... ok. it won't look very nice but there won't be a real performance-impact on this textbox-expression.

- Marcus

Kushal_Chawda

Yes, busy with lot of work.

Anonymous
Not applicable

Hi Vineeth,

Try this:

=aggr(rank(sum({1}Amount)),$(='[' &MaxString(

    Aggr(

        If(Upper(Left(Trim(SubField(SubField(GetCurrentSelections(),chr(13)),':',1)),5)) = 'LEVEL',

            Trim(SubField(SubField(GetCurrentSelections(),chr(13)),':',1))

        ,1)

    ,$Field)

)&']'))

Regards!!

vinieme12
Champion III
Champion III
Author

Thanks Manuel, this is exactly what I was trying to do but couldn't

Cheers

Vineeth

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Anonymous
Not applicable

You're wellcome!!

Cheers!