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

Announcements
Mastering Change Data Capture: Read Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

YTD Calculation

H all,

i want to calculate a YTD of year that i select.

For example if i select 2016-02 i want a sum of value of 2016-01 and 2016-02 etc...

Like field I have year_month (eg. YYYY-MM)

Can somebody help me?

1 Solution

Accepted Solutions
sunny_talwar

This?

Capture.PNG

Current

=RangeSum(Before(Sum({$<ReportYearMonth={">=$(=YearStart(Max(ReportYearMonth)))<=$(=Max(ReportYearMonth))"}, Flag = {'CY'}>}Qta), 0, ColumnNo()))

Previous

=RangeSum(Before(Sum({$<ReportYearMonth={">=$(=YearStart(Max(ReportYearMonth)))<=$(=Max(ReportYearMonth))"}, Flag = {'PY'}>}Qta), 0, ColumnNo()))

View solution in original post

20 Replies
ziadm
Specialist
Specialist

Hi Cecilia

use this set analysis

set vMaxYear = Max(Year)

Set vMaxDate =date(max(Date), 'DD MMM YYYY')

sum({<Year={$(vMaxYear)},Date={'<=$(vMaxDate)'},Month=>}Qta)

Thanks

sunny_talwar

Did you get time to look at my response here -> Re: Prior year for year_month field

ziadm
Specialist
Specialist

satishkurra
Specialist II
Specialist II

Check the attached

Not applicable
Author

Hi Satish, if we use a text object the solution works, but i would see the value 350 in the following table, below the date 02/01/2016, but it doesn't appear .

What can i do?

Thanks

satishkurra
Specialist II
Specialist II

Hi


I understand u have done this using pivot table. Now  go to presentation tab and select Date dimension and check show partial sum option. Now you can see total


Let me know 

Not applicable
Author

I Satish, i explain you better what I would. I attach a qvw with the pivot table in which I want below 02/01/2016 the value 350, below 03/01/2016 the value 700 and so on…. Like a progressive values…

I hope I have explain my issue better.

satishkurra
Specialist II
Specialist II

I don't think we can achieve this...

sunny_talwar

Why not Satish? Try this:

=RangeSum(Before(Sum({$<Date={">=$(=YearStart(Max(Date)))<=$(=Max(Date))"}>}[Sales]) , 0, ColumnNo()))

Capture.PNG