Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
prashantsanchet
Creator
Creator

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
Partner - Champion
Partner - Champion

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
Creator III
Creator III

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
Creator
Creator
Author

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

ychaitanya
Creator III
Creator III

Your syntax seems to be OFF here

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


it should be


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