Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
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,

Labels (1)
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)

??????

Anonymous
Not applicable
Author

Hi,

Something like below,

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


Satya