Skip to main content

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
CUSTOMERS ONLY: Now accepting customer applications for the 2023 Luminary Program: SUBMIT NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
chandra63
Creator
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.

Thanks in Advance.

Chandra

3 Solutions

Accepted Solutions
Lisa_P
Employee
Employee

Try this:
=Sum({$<FY={$(=>=$(vMinYear))}>}Revenue)

View solution in original post

pradosh_thakur
Master II
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.

View solution in original post

pradosh_thakur
Master II
Master II

I have attached a sample.

Learning never stops.

View solution in original post

24 Replies
Lisa_P
Employee
Employee

Try this:
=Sum({$<FY={$(=>=$(vMinYear))}>}Revenue)
chandra63
Creator
Creator
Author

HI Lisa,

Thanks for your reply,

still its not working .

Regards,

Chandra

Lisa_P
Employee
Employee

Sorry, just noticed should read =Sum({$<FY={$(=>=$(vMinyear))}>}Revenue)
It worked for me
pradosh_thakur
Master II
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.
chandra63
Creator
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.

pradosh_thakur
Master II
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

Pradosh

Learning never stops.
pradosh_thakur
Master II
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.
chandra63
Creator
Creator
Author

Hi Pradosh,

FY is field 

FY

2016

2017

2018

2019

 

LOAD
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

pradosh_thakur
Master II
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.