Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
ramanannad
Contributor III
Contributor III

variable in set analysis

Hi,

I have a requirement to have dimension toggle or alternate dimension in Pivot table of QlikSense. So I loaded the possible dimension values in a inline load and use it as a field to dynamically toggle dimension:

So this is how my calculated Dimension looks like:

if(getselectedcount(Dimension)=0,Region,

if(getfieldselections(Dimension)='Region',Region,

if(getfieldselections(Dimension)='State',State)))

Problem with this is, in my set analysis I am TOTAL'ing the values based on the dimension as such :

num((Sum(BASE_MSISDN)/Sum(total <Dimension> BASE_MSISDN)),'#,##0.00%')

*To get the share

With this dynamic dimension toggle, it fails as there isn't a single dimension I can specify in the red area above. Tried using a variable that captures the values in the inline field "Dimension" but this fails as well. Any suggestion on how to tackle this?

Hope the above is clear and seeking all the guru's of Qlik to help me out here

Thanks

Ram-Malaysia

1 Solution

Accepted Solutions
ramanannad
Contributor III
Contributor III
Author

Dimension :

vDimTest

if(getselectedcount(Dimension)=0,'Region',

if(getfieldselections(Dimension)='Region','Region',

if(getfieldselections(Dimension)='State','State')))

Set analysis :

num((Sum(BASE_MSISDN)/Sum(total <$(=vDimTest)> BASE_MSISDN)),'#,##0.00%')

*The above does not work, but it works when we tried this :

num((Sum(BASE_MSISDN)/Sum(total <$(=if(getselectedcount(Dimension)=0,'Region',

if(getfieldselections(Dimension)='Region','Region',

if(getfieldselections(Dimension)='State','State',

if(getfieldselections(Dimension)='Sales Area','Sales Area',

if(getfieldselections(Dimension)='Postcode','Postcode',

if(getfieldselections(Dimension)='Town','Town',

if(getfieldselections(Dimension)='Site Type','Site Type'))))))))> BASE_MSISDN)),'#,##0.00%')

*Note that the above has a few more dimension added.

Marking this as resolved....Thanks Vineeth

View solution in original post

5 Replies
vinieme12
Champion III
Champion III

You need to create a variable

vAggrOnField :

=if(getselectedcount(Dimension)=0,'Region',

if(getfieldselections(Dimension)='Region','Region',

if(getfieldselections(Dimension)='State','State')))

Dimension will be your existing calculated dimension

Expression:

num((Sum(BASE_MSISDN)/Sum(total <$(vAggrOnField)> BASE_MSISDN)),'#,##0.00%')

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
ramanannad
Contributor III
Contributor III
Author

Hi Vineeth,

Unfortunately this does not work. I think its the way we call the variable there.

Thanks

Ram

vinieme12
Champion III
Champion III

You should define the variable with a leading equal sign, please post a screeshot of your variable definition

Try:

num((Sum(BASE_MSISDN)/Sum(total <$(=vAggrOnField)> BASE_MSISDN)),'#,##0.00%')

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
annafuksa1
Creator III
Creator III

you should to use

num((Sum(BASE_MSISDN)/Sum(total {<'$(vAggrOnField)'>} BASE_MSISDN)),'#,##0.00%')

ramanannad
Contributor III
Contributor III
Author

Dimension :

vDimTest

if(getselectedcount(Dimension)=0,'Region',

if(getfieldselections(Dimension)='Region','Region',

if(getfieldselections(Dimension)='State','State')))

Set analysis :

num((Sum(BASE_MSISDN)/Sum(total <$(=vDimTest)> BASE_MSISDN)),'#,##0.00%')

*The above does not work, but it works when we tried this :

num((Sum(BASE_MSISDN)/Sum(total <$(=if(getselectedcount(Dimension)=0,'Region',

if(getfieldselections(Dimension)='Region','Region',

if(getfieldselections(Dimension)='State','State',

if(getfieldselections(Dimension)='Sales Area','Sales Area',

if(getfieldselections(Dimension)='Postcode','Postcode',

if(getfieldselections(Dimension)='Town','Town',

if(getfieldselections(Dimension)='Site Type','Site Type'))))))))> BASE_MSISDN)),'#,##0.00%')

*Note that the above has a few more dimension added.

Marking this as resolved....Thanks Vineeth