Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Live chat with experts, bring your API Integration questions. June 15th, 10 AM ET. REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

MTD,YTD

For calculating MTD YTD i used the approach stated in this usefull post,

http://iqlik.wordpress.com/2010/11/27/the-magic-of-set-analysis-point-in-time-reporting/

but dnt knw why it didnt work for me,

firstly i defined monthid ,

  • (Year(Date) – 1)  * 12 + Num(Month(Date)) as MonthId

expressions used ,

  • YTD (Year-To-Date) :

Count({$<MonthID = {“<=$(=Max(MonthID))”},
Year = {$(=Max(Year))},
Quarter = ,
Month = >} FILE_NO)

  • MTD (Month-To-Date) : 

Count({$<MonthID = {$(=Max(MonthID))},
Year = ,
Quarter = ,
Month = >} FILE_NO)

Can anybody tell wht wrong i did in this approach,

6 Replies
Sokkorn
Master
Master

Hi,

QlikView use case sensitive. Try to change MonthID to MonthId and see the result.

Regards,

Sokkorn

Not applicable
Author

Apolozise for tht,

but i needed some othr method, n in tht post i specified the method m using so posted in diff thread.

Not applicable
Author

whts happening in this method is,

whn m not selecting any year month, it result is fine

but whn i select previous year, i.e 2012, it projects the dec 2012 data as MTD

and also pls share some logic for calculating MTD YTD, m looking out for options to handle this.

Thanking You

Not applicable
Author

Hi prash,

How about this kind of approach: (no need to create a MonthID)

YTD:

Count({<Date = {">=$(=YearStart(max(Date))) <=$(=max(Date))"} Year =, Month = >} FILE_NO)

MTD:

Count({<Date = {">=$(=MonthStart(max(Date))) <=$(=MonthEnd(max(Date)))"} Year =, Month = >} FILE_NO)

Regards,

Lester

Not applicable
Author

HI Lester Rosete,

can u help me , how to do LMTD using this expression

Count({<Date = {">=$(=MonthStart(max(Date))) <=$(=MonthEnd(max(Date)))"} Year =, Month = >} FILE_NO)

??????

satyadev_j
Specialist
Specialist

Hi,

Something like below,

Count({<Date = {">=$(=MonthStart(AddMonths(max(Date), -1))) <=$(=MonthEnd(AddMonths(max(Date),-1)))"} Year =, Month = >} FILE_NO)


Satya