# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Contributor

## How to use Between function in Qliksense

I have a pivot table with distinct count of ID as a measure. I want to be able to count ID when its "Between" "From" and "To".

Whats the syntax for using between logic?

Will something like the following work?

Count({<[Year]={">\$(vFrom)"} and [Year]={">=\$(vTo)"}>} Distinct ID)???

Tags (3)
1 Solution

Accepted Solutions
Highlighted
Partner

## Re: How to use Between function in Qliksense

Try:

Count({<[Year]={">\$(vFrom)<=\$(vTo)"}>} Distinct ID)

7 Replies
Highlighted
Partner

## Re: How to use Between function in Qliksense

Try:

Count({<[Year]={">\$(vFrom)<=\$(vTo)"}>} Distinct ID)

Contributor

## Re: How to use Between function in Qliksense

Thank you so much

Contributor

## Re: How to use Between function in Qliksense

One more question, what if I want to show the dimension in my pivot table as years but only years between 'from' and 'to' years?

Something like this????

if([Year]={">\$(vFrom) and <=\$(vTo)"}), [Year])

Partner

## Re: How to use Between function in Qliksense

instead use set analysis in all expressions of Pivot table ({<[Year]={">\$(vFrom)<=\$(vTo)"}>}

and in Add Ons Section uncheck Show zero values.

It will restrict year in dimension according to values mentioned in set analysis

Contributor

## Re: How to use Between function in Qliksense

I want to use in dimension so that when users use the slider to set from and to values, the values show up as selections on the selection bar.

So please tell me if this can be used to restrict dimensions?

Partner

## Re: How to use Between function in Qliksense

try

if([Year]>='\$(vFrom)' and [Year]<='\$(vTo)', [Year])

Contributor

## Re: How to use Between function in Qliksense

Thank you so much. This is what I want although I realize i like the expression on the count is better.