Skip to main content

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Welcome to Qlik Community! Check out our new navigation! FIND OUT MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
shivanksharma
Contributor
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
marcus_sommer
MVP & Luminary
MVP & Luminary

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

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

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

- Marcus