Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
lost_rabbit
Contributor III
Contributor III

Dynamic dimension handling in Qlik Aggr() function

Is there a way to pass a dynamic dimension into the Aggr function?
I tried using GetObjectDimension(0) directly inside Aggr, but it didn’t work.

If(GetObjectDimension(0) = 'Dim1',
    Only(
        {<[Group Flag] = {1}>}
        Aggr(
            Rank([Scores]),
            [Class], [School]
        )
    ),
    If(GetObjectDimension(0) = 'Dim2',
        Only(
            {<[Group Flag] = {1}>}
            Aggr(
                Rank([Scores]),
                [Subject], [School]
            )
        )
    )
)

 
What I’d like is for the expression to dynamically use the dimension based on whatever the user picks from the alternate dimensions in the pivot table.

Labels (1)
4 Replies
SunilChauhan
Champion II
Champion II

although i did not understand properly.  I Guess you should use System FIeld .  there is a column which contains all the fieldName. May that Server your purpose

https://help.qlik.com/en-US/sense/May2025/Subsystems/Hub/Content/Sense_Hub/Scripting/system-fields.h...

Sunil Chauhan
lost_rabbit
Contributor III
Contributor III
Author

I need dynamic dimension so that the Aggr() function automatically picks the dimension from the pivot table, something like below but doesn't seem to work 

Aggr(Rank([Scores]), GetObjectDimension(0), [School])

 
System field doesn't work for this

Chanty4u
MVP
MVP

Try this.Dimension:

=ValueList('Class','Subject')

 

Measure:

Pick(

    Match(ValueList('Class','Subject'),'Class','Subject'),

    Aggr(Rank([Scores]), [Class], [School]),

    Aggr(Rank([Scores]), [Subject], [Sch

ool])

)

SunilChauhan
Champion II
Champion II

SunilChauhan_3-1758723768571.png

SunilChauhan_4-1758723818358.png

 

SunilChauhan_1-1758723615457.png

 

SunilChauhan_2-1758723635962.png

i am trying to simulate dynamic dimension using Qlikview. but sure we have  same in Qliksense too.if you see above screen shot we can select  from City and School. and Data rollup according to selection

Sunil Chauhan