# Qlik Sense App Development

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
Valued Contributor II

## How to replace getselectcount(year) with year = {\$(=Max(year)-1)} ?

Hi All

My below expression work fine :-

Sum({<year = {\$(=Max(if(getselectedcount(year)=0,2015,year))-0)} , month = {"<=\$(=Max({<year={\$(=Max(if(getselectedcount(year)=0,2015,year)))}, sales = {'*'}>} month))"}, cOST={"cOST"} >} Amount*-1)/Rate/1000

To reduce maintenance , i like to change to using :-

year = {\$(=Max(year)-1)}

Paul

1 Solution

Accepted Solutions
MVP

## Re: How to replace getselectcount(year) with year = {\$(=Max(year)-1)} ?

Is this what you are looking for?

Sum({<year = {\$(=Max(year) - 1)} , month = {"<=\$(=Max({<year={\$(=Max(year) - 1)}, sales = {'*'}>} month))"}, cOST={"cOST"} >} Amount*-1)/Rate/1000

15 Replies
Valued Contributor II

my QVF

MVP

## Re: How to replace getselectcount(year) with year = {\$(=Max(year)-1)} ?

You still need the same output still? because just replacing getselectedcount with this new set analysis will change the numbers

Valued Contributor II

## Re: How to replace getselectcount(year) with year = {\$(=Max(year)-1)} ?

Hi sunny

yes , it should be get the same result . because for this set of table i have 2016 data. in my previous table i dont have year = 2016

Paul

MVP

## Re: How to replace getselectcount(year) with year = {\$(=Max(year)-1)} ?

I can't think of way to get the same result without using some sort of the if statement. I will keeping looking though

Valued Contributor II

## Re: How to replace getselectcount(year) with year = {\$(=Max(year)-1)} ?

It is possible to help me change then I check why ?

Sent from my iPhone

MVP

## Re: How to replace getselectcount(year) with year = {\$(=Max(year)-1)} ?

Change the if Statement? Not sure I understand Paul

Valued Contributor II

## Re: How to replace getselectcount(year) with year = {\$(=Max(year)-1)} ?

Hi sunny

if IF statement i still can change the year ? by click on other year ?

Paul

MVP

## Re: How to replace getselectcount(year) with year = {\$(=Max(year)-1)} ?

Yes, if statement allows you to select year and use that year (the year you have selected)

Valued Contributor II

## Re: How to replace getselectcount(year) with year = {\$(=Max(year)-1)} ?

can show me how you do it ?

Community Browser