Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

prashantsanchet
Contributor

Dynamic dimension in set analysis

Hi team,

  • I have one dimension as customer  and the measure as sum({<[customer={"=Sum([discount])>=1000"} >}sales)

  • Now i want that dimention value to be dynamically vary based on user selection.

  • I have one listbox (cliember selection list box extension") where user can select the dimension which he wants.and this will be stored in variable vSelectedDimension.

  • I have created a one variable vDynamicDimension   which will return actual dimension value.

          if( vSelectedDimension='Customer'   ,[Customer], if( vSelectedDimensionr='Region' ,[Region] ))

  • Now i am trying to use $(vDynamicDimension) as dimesion and

        Sum({<[vDynamicDimension={"=Sum([discount])>=1000"} >}sales) as measure

  • But the result in both expression is coming different. What could be the reason?
4 Replies
agigliotti
Honored Contributor II

Re: Dynamic dimension in set analysis

you can't do this with set analysis because you MUST specify field name on the left side of equal sign, you can't use functions or variables instead.

you can do something like below:

sum( Aggr( if( sum([discount])>=1000, sum(sales) ), $(vDynamicDimension) ) )

ychaitanya
Contributor III

Re: Dynamic dimension in set analysis

we Can use the variables for the field name in SET Analysis.

i have been using like that , can you try like  below :

sum({<$(vMyVar)={'C'}>}Sales)


prashantsanchet
Contributor

Re: Dynamic dimension in set analysis

I am trying that also but still i am seeing a difference in values

ychaitanya
Contributor III

Re: Dynamic dimension in set analysis

Your syntax seems to be OFF here

"=Sum([discount])>=1000"} >}sales)


it should be


   Sum({<[vDynamicDimension={"$(=Sum([discount])>=1000)"} >}sales) as measure