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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Reg:Calulating YTD values

Dear All,

I am having a scenario,that have to calulate YTD&MTD values in pivot table.

Ytd is nothing but cummltive values.And MTD values values belongs to current month.Iam having data

from Ape 2009 to Sep 2009.Thing is when I clik Jul 2009,in YTD I have to attain cummltive values of APr 2009,May 2009,Jun 2009 and Jul 2009.That means,

YTD of Jul 2009->(Apr 2009+May 2009+Jun 2009+Jul 2009)

So if any one of you come across this kind of issue please help me out.It is very urgent.

Thanks&Regards

Jai

3 Replies
Not applicable
Author

Hi,

You can sole this by using set analysis. see an example for YTD below (this is an example of how the expression could look like)

vTodayDate is a variable you can set in the script using a let statement

Sum({<[Accounting period] = {'$(=monthstart(vTodaysDate))>} RowAmount)



Not applicable
Author

Hi Again,

to clarify my example was for MTD and the expression should be

Sum({<[Accounting period] = {'$(=monthstart(vTodaysDate))'}>} RowAmount)

See also below for a simple example for YTD is below

Sum({<[Accounting year] = {$(=vCurrentYear)}>} RowAmount)

Not applicable
Author

sum(if((Week*1)<=(vCurrentWeek*1),rowamount))

sum(if((Month*1)<=(vCurrentMonth*1),rowamount))

Sums if month is less than or equal too current month. Same thing for week.