# QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Action-Packed Learning Awaits! QlikWorld 2023. April 17 - 20 in Las Vegas: REGISTER NOW
cancel
Showing results for
Did you mean:
Creator

## minYear to Maxyear (YTD)

hi,

I'm new to Qlikview and am trying to get something I thought was relatively simple but seems bit difficult.please help me to get this.

i have year field(FY)-2016,2017,2018,2019

Variables : vMinyear and vMaxyear

have to calculate Revenue

suppose if i select 2016 output should be 2016 to 2019

if 2017: 2017 ,2018, 2019

2018: 2018 to 2019

i have tried like below

sum({<FY={">=\$(vMinyear)<=\$(vMaxyear)"}>}Revenue) but it showing selected year only.

same for  Quarter

Please let me know how to achieve this via set analysis.

Chandra

3 Solutions

Accepted Solutions
Employee
Try this:
=Sum({\$<FY={\$(=>=\$(vMinYear))}>}Revenue)
Master II

Try below

In Variable overview

vMinyear       =min(FY)

vMaxyear      =max({1}FY)

Note the = i have put before the variable

use your expression as it is and it will work , if it doesn't let me know.

Learning never stops.
Master II

I have attached a sample.

Learning never stops.
24 Replies
Employee
Try this:
=Sum({\$<FY={\$(=>=\$(vMinYear))}>}Revenue)
Creator
Author

HI Lisa,

still its not working .

Regards,

Chandra

Employee
Sorry, just noticed should read =Sum({\$<FY={\$(=>=\$(vMinyear))}>}Revenue)
It worked for me
Master II

how does your vMaxyear and vMinyear look like?

When you select an year it will be automatically be the min and max year. You need the condition when 2017 selected is

>=2017 <=2019 right so to do that you need to change your vMaxyear defination , assuming it is just max(year) you need to change it to max({1}year), so this will not change with selection , if you need current year use year(today()) in the vMaxyear expression. You can leave vMinyear as it is then your expression shall work.

Learning never stops.
Creator
Author

hi Thakur,

my variable is same as you told

=Max({1}Maxyear)

is anything wrong in expression.pls check

=sum({<FY={">=\$(vMinyear)<=\$(vMaxyear)"}>}Revenue)

Thanks,

Chandra.

Master II

Hi

How does your vMinYear looks like ? Is the field FY number please check that as well. Try and if it doesn't work we can work out a sample .

Thanks

Learning never stops.
Master II

@chandra63 wrote:

my variable is same as you told

=Max({1}Maxyear)

Shouldn't your variable be =max({1}FY) ?

Learning never stops.
Creator
Author

FY is field

FY

2016

2017

2018

2019

Min(statistic_date) as MinDate,
Max(statistic_date) as MaxDate,
min(FY) as Minyear,
max(FY) as Maxyear
RESIDENT Revenue;

vMinyear=min(FY)

please check this vMinyear variable. is it right?

Thanks & Regards

CHANDRA

Master II

Try below

In Variable overview

vMinyear       =min(FY)

vMaxyear      =max({1}FY)

Note the = i have put before the variable

use your expression as it is and it will work , if it doesn't let me know.

Learning never stops.
Community Browser