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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
stabben23
Partner - Master
Partner - Master

MTD yesterday

I found a problem today when a new month begin.

I show MTD, but it will always calculate yesterdays value, so MTD should today show 1/1-31/1.

My set expression is : sum({$<Date ={">=$(=$(vThisMonthsStart))<=$(=$(vYesterday))"}>}Price)

This expression will works fine tomorrow (2/2) but not today (1/2), and i know that vThisMonthsStart is the problem.

vThisMonthStart = date(date(MonthStart(today()))'YYYYMMDD') and this will be 20130201 today, NOT good.

date(date(MonthStart(today()-1))'YYYYMMDD') will give me the correct 20130101, but what happens tomorrow with that variable?

Will it still be 20130101?

This will also give me a second problem that is how to find vThisMonthsStartLastYear.

Labels (1)
2 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Tomorrow, today being the 1st of februari, date(MonthStart(today()-1))'YYYYMMDD') will return 20130201. So it looks like that would be the correct expression for your purposes.

edit: vThisMonthsStartLastYear can be calculated with addyears($(vThisMonthStart),-1) assuming you want that based on yesterday too.


talk is cheap, supply exceeds demand
stabben23
Partner - Master
Partner - Master
Author

I'll try and see whats happens tomorrow. Any clue how i shall solv vThisMonthsStartLastYear?

This problem will only show up 1:st every month, but its not ok anyway.