Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
shivanksharma
New Contributor

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
MVP & Luminary
MVP & Luminary

Re: Passing variable as value in Nested-Set-Analysis

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

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

- Marcus

2 Replies

Re: Passing variable as value in Nested-Set-Analysis

What expression are you using for AccMaxQuarter?

MVP & Luminary
MVP & Luminary

Re: Passing variable as value in Nested-Set-Analysis

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

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

- Marcus