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

One Expression...More States

I have a requirement where I need to create an expression where the Expression has to work with Alternate State as well as Default or Inherited State. For example, if I have a List Box1 in Alternate State 1 and List Box2 in Default/Inherited State and the user makes selection on either of the List Boxes, the expression should accept the Filter from both the states. How do I create the Expression with two States in it?

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar

I guess this

Count({AltState1<[Admin] = {'Admin'}, Month = $::Month*AltState1::Month>}[SerialID])

View solution in original post

9 Replies
sunny_talwar

May be like this

Sum({<Field1 = AS::Field1, Field2 = $::Field2>}Measure)

Here Field1 will react to Field1 selection in alternate state AS and Field2 will react to selection in default state. This can be further fine tuned based on knowing which state is the object in which we are using this expression. If the object is in default/inherited state, then you can just use this

Sum({<Field1 = AS::Field1>}Measure)

If the object is in alternate state AS, then you can just use this

Sum({<Field2 = $::Field2>}Measure)
qlikwiz123
Creator III
Creator III
Author

Hi Sunny,

 

My expression is something like this in a Text Box and the Text Box Object is in 'AltState1':

Count({AltState1<[Admin]={'Admin'}>}[SerialID])

 

The expression will react to objects/Filters placed in AltState1. I also have to make the expression react to objects/filters placed in Default or Inherited State. How do I achieve it in this case?

sunny_talwar

You want all fields from Alternate State and Default/Inherited state to react to this? May be this

Count({AltState1<[Admin] = {'Admin'}>*$<[Admin] = {'Admin'}>}[SerialID])
qlikwiz123
Creator III
Creator III
Author

Problem is:  I have Month list box which is not assigned to any Alternate state. If  I make any selections on Month list box , my expression is not filtered for selected months.

 

Is there any way I can assign 2 alternate states to this Month list box only as I need my expression to react to AltState1 filters and this Month list box filter which is like a Universal filter.

jonathandienst
Partner - Champion III
Partner - Champion III

>>Is there any way I can assign 2 alternate states

No. But Sunny's expression will react to selections in the default state and in AltState1.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
sunny_talwar

I tried this and it seems to work for selection in both Inherited as well as alternate state

=Sum({<Month = $::Month*AS::Month>}Sales)
qlikwiz123
Creator III
Creator III
Author

Awesome Sunny. Thank you. Could you please tell how to create the same logic in my case since I have specific values for for fields in the expression?

Count({AltState1<[Admin]={'Admin'}>}[SerialID])

Selection Field is Month

I am looking for 'Admin' value in Admin field in this expression. I am a bit lost in framing my expression with your suggested way.

sunny_talwar

I guess this

Count({AltState1<[Admin] = {'Admin'}, Month = $::Month*AltState1::Month>}[SerialID])
qlikwiz123
Creator III
Creator III
Author

Fantastic. Looks like this is working. Will get back if I face an issue. Thanks a lot for being patient and helpful 🙂