Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
rfigueroa
New 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

Tags (1)
1 Solution

Accepted Solutions
jsn
Honored Contributor

range with set analysis

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 )

2 Replies
jsn
Honored Contributor

range with set analysis

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
New Contributor III

range with set analysis

Johannes, it works... thank you!

Community Browser