Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
leale1997
Contributor III
Contributor III

Can I use more than one Alternate State on a Chart?

I have a Chart that I have turned into a drop down list. 

There is a selection box that allows for me to set the Chart to one "Alternate State".

I would like the Chart to respond to more than one 'Alternate State'

12 Replies
oknotsen
Master III
Master III

The state of the chart only defines what states the expressions assume to be the state to do the calculations in when you do not define a Set in those expressions. You can have multiple expressions doing calculations on various states, even combining states.

Example:

Expression 1: sum({$} Sales)

Expression 2: sum({State2} Sales)

Expression3: sum({$ < ProductName = State2::ProductName > } Sales)

May you live in interesting times!
leale1997
Contributor III
Contributor III
Author

Hey!

Thanks for the quick reply.

I am using a Chart to create a Drop Down List. Therefore I have no Expressions in my Chart.  I have Dimensions that are defined as: = GetFieldSelections(LegProject)

Is it possible to use the multiple states inside of the Dimension?

Gysbert_Wassenaar

A calculated dimension also contains an expression. And as okg‌‌ said you can use multiple alternate states in an expression.


talk is cheap, supply exceeds demand
leale1997
Contributor III
Contributor III
Author

Thanks Gysbert!

I am having difficulty putting together the proper formula.  Every example I find for calculations with multiple states involves mathematical functions.  I have a drop down list box and I would like to selections chosen to apply to the objects on the page which is a little different.

This is what I have in the dimension expression box now:

= GetFieldSelections(LegProject)

I have three alternate states on my worksheet Created, Open, and Closed.

So I think this is what I want it to look like:

= GetFieldSelections({LegProject Created} {LegProject Open} {LegProject Closed})

But that's not working,  Any idea what I am missing?

Gysbert_Wassenaar

I have trouble understanding what you're trying to do. Can you post a small qlikview document that illustrates the problem?


talk is cheap, supply exceeds demand
leale1997
Contributor III
Contributor III
Author

Sure thing! Attached is a small test file.

Gysbert_Wassenaar

You can use an expression like this one in your pie charts (please change those dysfunctional monsters to bar charts) to use selections from the default state in you charts that are assigned to the different alternate states:

= num(count({<ProjectType=$::ProjectType,SourceType=$::SourceType>}DISTINCT  RecordID), '#,##0', '.' , ',' )

That way all your pie charts will 'listen' to the single set of dropdowns in the default state.

And there's also no need to use calculated dimensions. Just use the ProjectType and SourceType fields as dimension.


talk is cheap, supply exceeds demand
leale1997
Contributor III
Contributor III
Author

LOL! If you think that's messy you should see the entire worksheet.  In short I was asked to create a very specific page to assist users who have difficulties filtering for their own data.  So the sample I gave you was highly simplified,  The actual formula in my pie charts looks like this:

=num(count (DISTINCT if(LegProject='CAPA'

OR LegProject='Product Complaint'

or LegProject='Evaluation'

or LegProject='Data Source'

or LegProject='Deviation'

or LegProject='OOS'

or LegProject='EMIR'

OR LegProject='VSCR'

OR LegProject='UIR'

or LegProject='Assessment'

or LegProject='Change Source'

or (LegProject='Observation' and LegSourceType='GMP Quality Compliance')

or (LegProject='Observation' and LegSourceType='Regulatory Agency'),

LegRecordID)), '#,##0', '.' , ',' )

As you can see there are several set parameters in the formula.  Which is why I was hoping to change the drop down list.  Any ideas?

Gysbert_Wassenaar

You can try this expression:

=num(count({<ProjectType=$::ProjectType,SourceType=$::SourceType,LegProject='CAPA','Product Complaint','Evaluation','Data Source','Deviation','OOS','EMIR','VSCR','UIR','Assessment','Change Source'}>

+<ProjectType=$::ProjectType,SourceType=$::SourceType,LegProject={'Observation'}, LegSourceType={'GMP Quality Compliance','Regulatory Agency'}>} DISTINCT LegRecordID), '#,##0', '.' , ',' )

Or create two bookmarks for the two sets of selections and use those bookmarks:

=num(count({BM01<ProjectType=$::ProjectType,SourceType=$::SourceType>+BM02<ProjectType=$::ProjectType,SourceType=$::SourceType>} DISTINCT LegRecordID), '#,##0', '.' , ',' )


talk is cheap, supply exceeds demand