Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

paulyeo11
Valued Contributor II

How to make my chart 1 also work fine , if i not select year = 2015 ?

Hi All

My expression BELOW work fine FOR CHART 1 when i select year = 2015 :-

Sum({$<year = {$(=Max(year)-1)}, month = {"<=$(=Max({<year={$(=Max(year))}, sales = {'*'}>} month))"}>}distinct REVENUE_C/1000)

My question is how to make my chart 1 also work fine , if i not select year = 2015 ?

Paul

1 Solution

Accepted Solutions
t_chetirbok
Valued Contributor

Re: How to make my chart 1 also work fine , if i not select year = 2015 ?

if I understand you correct try

Sum({<year = {$(=Max(if(getselectedcount(year)=0,2015,year))-1)}

,

month = {"<=$(=Max({<year={$(=Max(if(getselectedcount(year)=0,2015,year)))}, sales = {'*'}>} month))"}

>} REVENUE_C/1000)

10 Replies
paulyeo11
Valued Contributor II

Re: How to make my chart 1 also work fine , if i not select year = 2015 ?

enclosed my QV doc

Re: How to make my chart 1 also work fine , if i not select year = 2015 ?

Hi,


Can you please explain with detail. What is the Max year you have. Do you want to have 2015 as max year when no year is selected?

Regards,

Kaushik Solanki

t_chetirbok
Valued Contributor

Re: How to make my chart 1 also work fine , if i not select year = 2015 ?

hi!

when you don't select year, max year = 2016 and data in your expression = 0, so char doesn't display anything.

Do you want to use 2015 as max year default?

Re: How to make my chart 1 also work fine , if i not select year = 2015 ?

When you are selecting 2015, the information on the chart you are seeing is for 2014 because you are using the set analysis

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

now when you have nothing selected it is showing 2015 information. You want to see 2014 if you don't select anything? or do you want to see 2015?

Re: How to make my chart 1 also work fine , if i not select year = 2015 ?

Hi,

The issue is that your Competitor data is available only for the December Month for all years.

Your default expression takes 2015 as year and month <=3, which doesnt include any competitor and this it is not showing any data,

For 2015 selection the Year in chart becomes 2014 and month becomes <=12, which includes the December month and thus you can see the chart values properly.

If you remove the Month condition from Chart expression, your expression will  work for 2016 selection also.

Regards,

Kaushik Solanki

t_chetirbok
Valued Contributor

Re: How to make my chart 1 also work fine , if i not select year = 2015 ?

if I understand you correct try

Sum({<year = {$(=Max(if(getselectedcount(year)=0,2015,year))-1)}

,

month = {"<=$(=Max({<year={$(=Max(if(getselectedcount(year)=0,2015,year)))}, sales = {'*'}>} month))"}

>} REVENUE_C/1000)

paulyeo11
Valued Contributor II

Re: How to make my chart 1 also work fine , if i not select year = 2015 ?

Hi Tatsiana

look like your expression give me the figure i am looking for.

But you expression have below 2015 , make me wonder why you there it year 2015 ?

if(getselectedcount(year)=0,2015

Paul

paulyeo11
Valued Contributor II

Re: How to make my chart 1 also work fine , if i not select year = 2015 ?

Hi sunny

i think miss Tats expression is correct , because the chart does show the value i need , i guess she make my default year select = 2015 , when i not select any year , and when i select the year=2014 , chart display 2014 sales.

Paul

t_chetirbok
Valued Contributor

Re: How to make my chart 1 also work fine , if i not select year = 2015 ?

If you don't make any year selection: if(getselectedcount(year)=0

year will be equal 2015 by default

else year = your selected year

if(getselectedcount(year)=0, 2015, year)

Community Browser