Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Alternate State in Set analysis

Hi, I have a table

   Year        Month       Invoice Number

2001Jan1
2001Feb2
2001Mar3
2001Apr4
2002Feb5
2002Mar6
2002June7
2002May8
2003June9
2003July10
2003Aug11
2003Sep12
2003May13
2003Apr

14

I have two text boxes and within that I have the following two expressions:

1. =count({$<Year = p({State1}Year)>} DISTINCT [Invoice Number]) and

2. =count({$<Year = State1::Year>} DISTINCT [Invoice Number])

And then I have One list box with Year field and it is in State 1 and another List Box with Month field and it is in default state.

While selecting values from either from Year List Box and Month List Box, I am getting the same value for both the expressions. Can someone help me with this? What is the difference between these two expressions and why I am getting the same value for both the expressions?

But from the help document:

The difference between the expressions is that in the first one, the possible values on invoice number from State1 are passed into the default state. In the second expression, the selected values from State1 are passed into the default state. If the user has not made any invoice number selections in State1, no invoice number values will be passed into the default state.

Thanks,

Karthick S

1 Solution

Accepted Solutions
sunny_talwar

My bad, I missed State1 reference in the second expression. the difference between the two expression is as follows

1) =count({$<Year = p({State1}Year)>} DISTINCT [Invoice Number]) and

If you happen to have another filter in state1 such as Month and if you select June in your sample, we only have 2002 and 2003 available for selection. At this time this expression will give 10.

2) =count({$<Year = State1::Year>} DISTINCT [Invoice Number])

Same selection as above will continue to show 14

Capture.PNG

View solution in original post

4 Replies
sunny_talwar

Can you share a sample where it shows that selection in alternate state is giving the same output for the two expression when you make a selection in Year field? I think Month field giving same output make sense, but Year field selection doesn't make sense. I think it should give different output based on selection in Year field.

Anonymous
Not applicable
Author

Sunny,

I have attached the document. Please have a look at that.

According to you, how that two expression should work differently? Please explain

sunny_talwar

My bad, I missed State1 reference in the second expression. the difference between the two expression is as follows

1) =count({$<Year = p({State1}Year)>} DISTINCT [Invoice Number]) and

If you happen to have another filter in state1 such as Month and if you select June in your sample, we only have 2002 and 2003 available for selection. At this time this expression will give 10.

2) =count({$<Year = State1::Year>} DISTINCT [Invoice Number])

Same selection as above will continue to show 14

Capture.PNG

Anonymous
Not applicable
Author

Sunny,

I understand now. Thanks for your explanation.

=count({$<Year = p({State1}Year)>} DISTINCT [Invoice Number])-- This expression is not explicit to Year field selection. So either selecting Month or Year , the expression value changes


whereas the second expression,

=count({$<Year = State1::Year>} DISTINCT [Invoice Number]) -- This is explicit to Year field. The value changes only for Year field and the value does not change for any selection in Month field.