Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Basic Variable Creation

Hi all,

I've got an extremely basic question around creating a variable based on a field value.

Field name = Store_Group

Possible values = Group X, Group Y, Group Z

How can I create a variable to only display Store_Group where the value = Group X?

Basically I have a few charts that will be pre-filtered for report users.

Many thanks,

Dave

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Not sure if you need a QV variable here, wouldn't the variable just hold 'Group X' then?

If you want to filter a chart permanently, you can either create a calculated dimension

=if(Store_Group = 'Group X', Store_Group)

and Suppress NULL on dimension tab.

Or use a set expression in all your expression aggregation functions, for example

=sum({<Store_Group = {'Group X'}>} Value)

View solution in original post

7 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     Instead of variable, you can use the Set Analysis to filter the data in the charts.

     Anyways, in your scenario, you want variable name to be Group X or you want that variable to hold the value Group X?

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
swuehl
MVP
MVP

Not sure if you need a QV variable here, wouldn't the variable just hold 'Group X' then?

If you want to filter a chart permanently, you can either create a calculated dimension

=if(Store_Group = 'Group X', Store_Group)

and Suppress NULL on dimension tab.

Or use a set expression in all your expression aggregation functions, for example

=sum({<Store_Group = {'Group X'}>} Value)

sudeepkm
Specialist III
Specialist III

If you just wanted your charts to show Store_Group='GroupX' then you can use set analysis in the chart expression.

sum({<Store_Group={'Group X'}>}amount ) or

if you want this to be a default value in the Store_Group filter box so that when user logs in they will see this by default and they can select another value of Store_Group from the filter box if they want. for this you can use Trigger Action (Select in Field) and you can have a Clear button created which will have the Select in Field action of Store_Group field as the Group X so that when users hit clear button the value goes back to default value.

tresesco
MVP
MVP

If your variable is static(only one possible value), then you can directly store the string in the variable or use that string in place of the variable directly.If variable, then like:

vVariable='Group X'

Not applicable
Author

=sum({<Store_Group = {'Group X'}>} Value)

=Count({<Store_Group = {'Group X'}>} Value)  

etc

Not applicable
Author

Hi Dave,

  Use the GetFieldselection() function. it gives you the selection of the field value.

  Declare a varaible

   Ex : $(V1)=Getfieldselection(Fieldname) and then give it a layout condition $(V1)=Group X then it displays whenever the varaible having GroupX.

Not applicable
Author

Thanks all, lots of useful suggestions.