# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Contributor

## If logic help in filter pane

Hi Experts,

In the below Month Year fitlerpane , could you please help me to show only Current year 2019 and Previous Year 2018 Related month Year values by take our 2017 Month year values  in UI

.

4 Replies
Honored Contributor II

## Re: If logic help in filter pane

If(Year(MonthYear)= 2018 or Year(MonthYear)= 2019, MonthYear,null())

then supress null

If you are looking for this year and last year data use year(today()) and year(today())-1 instead of hard coding 2018 and 2019

Learning never stops.
Valued Contributor II

## Re: If logic help in filter pane

Try this,

If(wildmatch(MonthYear,'*2018','*2019'),MonthYear)

Regards,
Vishal Waghole
Contributor

## Re: If logic help in filter pane

I am looking dynamic solution. I need to use max(Year) and Max(Year)-1 all month years.

I struck at if logic syntax.

Valued Contributor II

## Re: If logic help in filter pane

First of all create Year field from your MonthYear field.
Then use below steps to dynamically take only latest two years from your year field.

Create two variable using below definition.

vMaxYear = max(Year)
vMaxYear1=max(Year,1)

Create list box using below expression.

=Aggr(Concat({<YEAR={'\$(vMaxYear)','\$(vMaxYear1)'}>} Distinct Year), Year)

Hope this will work for you.

Thanks,
Vishal Waghole