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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Passing variable as value in Nested-Set-Analysis

I am trying to achieve a complex set analysis in Qlikview.

Aim:

To fetch the second highest sales of an outlet for a particular product where the ranking is done on the complete set excluding the currently selected outlet ({Super Set} - {Current Selection}).

Challenge:

The ranking needs to be done on the latest quarter and not on the aggregation of all and I am trying to pass the quarter value via a variable. Since the position where the variable is to be passed as value is in the second depth within the set analysis, the code fails.

Code:

=SUM(

     {1<[Product Brand]={'Product1'},

        [Outlet]= {"=RANK(SUM({<[Product Brand]={'Product1'},

                                [Outlet]=e([Outlet]),

                                [Quarter]={"$(=$(AccMaxQuarter))"}

                               >}

        [Sales]))=1"}

       >}

[Sales])

where:

AccMaxQuarter is the variable containing the latest quarter

If I replace the variable with hard-coded constant, it works.The variable itself is correctly initialized and contains the accurate value.

1 Solution

Accepted Solutions
marcus_sommer

Maybe you used the variable without $-sign expansion like:

{"$(AccMaxQuarter)"} or {"AccMaxQuarter"}

- Marcus

View solution in original post

2 Replies
sunny_talwar

What expression are you using for AccMaxQuarter?

marcus_sommer

Maybe you used the variable without $-sign expansion like:

{"$(AccMaxQuarter)"} or {"AccMaxQuarter"}

- Marcus