# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Valued Contributor II

## How to write Set analysis for below condition

Hi Experts,

Please help me below thread.

I have master calendar in that  I have  Year, Month Quarter Fields. I want write  expression like below.

1. If I have select any year  then values should display next year first month.

for e.g: If  I have select  fin Year 2017-18 then values display April 2018

If  I have select  fin Year 2016-17 then values display April 2017

2. If I have not done any selection then values should only max month.

3. If I Have select max FinYear then values should max month.

Thanks & Regards,

Arvind Patil

Tags (1)
7 Replies
Contributor II

## Re: How to write Set analysis for below condition

If possible, Can you Attach you qvf file ?

Valued Contributor II

## Re: How to write Set analysis for below condition

Sorry to say but i cant attach Qvf file .

If you require more clarification then i will provide you.

Regards,

Arvind Patil

Contributor II

## Re: How to write Set analysis for below condition

Can you tell me on what all the Calendar Related Fields available in data, along with sample of 2 transactions.

Contributor III

## Re: How to write Set analysis for below condition

How about this one.

=If(GetSelectedCount([Fin-Year])>=1,SUM({<MonthName={'\$(vMinMonth)'}>}Value),SUM({<MonthName={'\$(vMaxMonth)'}>}Value))

Regards,

Renuka S

Honored Contributor II

## Re: How to write Set analysis for below condition

You selecting single Year or Multiple year?

If you select 2018, it should show the month start from apr?

And if you select 2017, month should start from 2017-Apr?

or Just show Apr month if a Year is selected and then you manually select other months?

Contributor III

## Re: How to write Set analysis for below condition

Hi!

Check this:

Store the max finyear in a variable (\$(maxFinyear))

If(Finyear<>\$(maxFinyear), Monthname(yearstart(addyears(Finyear,1))), month(max({1}Finyear)))

RC

Contributor

## Re: How to write Set analysis for below condition

Hi AP,

Try with making new field as left([Fin Year],4) as [Fin Year New]

then

if([Fin Year New]-=vMaxFinYear,vNextYearMonthStart,vMaxMonth)

Just a rough idea.

Regards,