# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

New Contributor

## Less than equal to Selected year and month

i need to show data until selected year and Month

have Joining date till the selected year moth need to know number of employees

tried build two variables

1.vYear ==passing selected year

2. vMonth =passing selected Month

3. concatenation both variables vyearmonth =vYear &vMonth

have column year(joinng date)&month(joining date)  created this column in database

201901

201902

201903

.

.

.

used below expression but not working

=Count(distinct{<yearmonth=  {"<=\$(vyearmonth )"}>} empno)

need urgent

it s beheaving strange

Tags (2)
1 Solution

Accepted Solutions
Honored Contributor II

## Re: Less than equal to Selected year and month

I think you should use the below expression:

Count( {< year =, month =, yearmonth =  {"<=\$(=vYearMonth )"} >} distinct empno )

I hope it will fix your problem.

14 Replies
Valued Contributor

## Re: Less than equal to Selected year and month

try \$(=

=Count(distinct{<yearmonth=  {"<=\$(=vyearmonth )"}>} empno)

Valued Contributor

## Re: Less than equal to Selected year and month

i did not get it well

you can try

=Count(distinct{<yearmonth=  {"<=vyearmonth "}>} empno)

New Contributor

## Re: Less than equal to Selected year and month

hi  dilip thank you for help

i use ur expression it s giving data for selected year and month..i want to show data until selected year and month

New Contributor

## Re: Less than equal to Selected year and month

hi jahanzeb,

my requirement is user select year and month ,i need to count number of employees until selected year and month

i created 3variable

vYear= selected year

vMonth= Selected Month

i concatenated two variables in to one variable

vYearMonth =vYear&vMonth

my expression below

Count(distinct{<yearmonth=  {"<=\$(=vYearMonth )"}>} empno)

my expression not giving data lessThan equal selected Year Month

it is giving data for selected month and year ...i need less than selected year month

have columns

Valued Contributor

## Re: Less than equal to Selected year and month

Not sure I understand the problem. Do you mean if users select 201809 it should show 201808 and below?

If so just to change expression in < rather than <=

Count(distinct{<yearmonth=  {"<\$(=vyearmonth)"}>} empno)

Valued Contributor

## Re: Less than equal to Selected year and month

So may be

Count(distinct{<yearmonth=  {"<=max(yearmonth) >=\$(=vYearMonth )"}>} empno)

or change some thing that you can get today's yearmonth or may be max

regards

Honored Contributor II

## Re: Less than equal to Selected year and month

also make sure 20188 should be 201808, 20181 -> 201801, etc... in your "yearmonth" field.

New Contributor

## Re: Less than equal to Selected year and month

but use select 2019 as year and 09 month

need to selections

created two variables

vYear

VMonth

and concatenated

have DB column YearMonth

i use below expression it is showing only for selected year and month not showing all values

New Contributor

## Re: Less than equal to Selected year and month

Than you Andrea

i change my data

i need expression my expression not giving <= values