Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Talk to Experts Tuesday, Live Q&A, September 22: Moving from QlikView to Qlik Sense. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Specialist II
Specialist II

Year To Month

Hi All,

I have to show data by YTD (YTM) - no date selection (not required).

- Date filed is YearMonth (like 201705).

- Derived Year and Month from YearMonth field.

For instance :

Selections: Year = 2017 (2015,2016,2017) and Month = May (Jan....Dec), whenever i select (YTD) button report should display Year to Month data like 201701, 201702, 201703,201704,201705

Thanks,

Nihhal.

12 Replies
Highlighted
Specialist II
Specialist II

Hi

Have a look: Set Analysis for certain Point in Time

Hope it helps!!

Highlighted
Creator II
Creator II

Try this one

vCurrent_Year:

Year={"$(=GetFieldSelections(Year))"}

vYTD_Date:

Date={"<=$(=$(vSelected_Date))"}

Exp:

=sum({<Month,$(=vCurrent_Year),$(=vYTD_Date)

>}Sales)

Highlighted
Creator II
Creator II

vSelected_Date:

Date(MakeDate(GetFieldSelections(Year),GetFieldSelections(Month),if(IsNull(GetFieldSelections(Day)),max({<Month={'$(=GetFieldSelections(Month))'}>}Day),GetFieldSelections(Day))),'YYYY/MM/DD')

Highlighted
Specialist II
Specialist II

Variable 1: Num(Year(yearstart(Today())))&num(month(YearStart(Today())),'00')

Variable 2: Num(Year(yearstart(Today())))&num(month(Today()),'00')

Sum({<YearMonth={">=$(Variable1)<=$(Variable2)"}>} sales)

Highlighted
Specialist II
Specialist II

Hi Sivaraj - Thanks for your help.

Just i have given one year (2017) as example, actual scenario they are couple of years,

I think i have to created 2 more variables like vSelectedYear and vSelectedMonth.

am i right?

Highlighted
Not applicable

Follow following steps:-

1) Create variable e.g:- vConvertDate, in definition, let it be empty

2) create button, in action tab, click on add, then select 'Set Variable'. In variable box input 'vConvertDate' and in value input 'CD' then finish/ok.

3) either create the desired format in script or in calculated dimension if you want, like ''Year(DateField)&Month(DateField)''.

4)tick the enable condition and write the following condition "if(vConvertDate='CD',1,DateField)"



Hope this will solve you problem. If not let us know, and if possible show some sample data.



Thanks,

Highlighted
Creator II
Creator II

Try which i post , it will work

as i tried in my app already, hence it is working

Highlighted
Specialist II
Specialist II

Hi,

Thanks for your post. Actually do not have any day field in my requirement.

anyways can you share the app which you have worked out.

Highlighted
Creator II
Creator II

Hi,

Just try to change the month in the app so that chart will visible as per you requirement

as per your requirement we supposed to maintain day field because it will give you all days in a month

example : if you select 2016, feb that means the should populate from jan 1 st to feb 28th , that's why i kept Day field

it's not a big deal to create a day field by using date right?

Regards,

Dev