Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
rfigueroa
Contributor III
Contributor III

range with set analysis

Hi all, I'm trying to get a distinct count on the records between a range based on the [YearMonth] selected, this is the expression:

Count(DISTINCT {<YearMonth_Rep = {">=$(=min(YearMonth))"}, YearMonth_Rep = {"<=$(=max(YearMonth))"} >} ReportID )

YearMonth_Rep and YearMonth are numeric values in the form 201101, 201102 for january and february 2011 respectively.

If I use the MIN or MAX part only, the filter works as expected, however trying to get both sentences together doesn't work.

How should I change the sentence?

Or do you have another recomendation on how to achieve this?

Thanks in advance

Robert

1 Solution

Accepted Solutions
Anonymous
Not applicable

Hi,

You'll want to put both conditions within the same {}. You only define the set for YearMonth_Rep at one place, something like:

sum( {$<Year = {“>1978<2004”}>} Sales )


So you should update your expression to:

Count(DISTINCT {<YearMonth_Rep = {">=$(=min(YearMonth))<=$(=max(YearMonth))"} >} ReportID )

View solution in original post

2 Replies
Anonymous
Not applicable

Hi,

You'll want to put both conditions within the same {}. You only define the set for YearMonth_Rep at one place, something like:

sum( {$<Year = {“>1978<2004”}>} Sales )


So you should update your expression to:

Count(DISTINCT {<YearMonth_Rep = {">=$(=min(YearMonth))<=$(=max(YearMonth))"} >} ReportID )

rfigueroa
Contributor III
Contributor III
Author

Johannes, it works... thank you!