Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
amit_saini
Master III
Master III

Previous YTD Help

Hi All,

Here’s the question I had about qlikview. I want to calculate Previous YTD (Same time frame as the current year) however, whenever I reload my data, the Prev YTD column stays static and the current year data changes based on the new data.

I expect the Prev YTD column to look back in time and fetch data for the same time frame as last year and keep accumulating each time I reload data.

I'm using something like below , but looks like it's not working.

=SUM({$<SalesDate={'>=$(=AddYears(YearStart(Today()),-1))<=$(=AddYears(Date(Today()),-1))'}>}InvoiceSales)

Any suggestions?

Regards,

AS

6 Replies
amit_saini
Master III
Master III
Author

Guys any suggestion?

Regards,

AS

sunny_talwar

May be try this

=Sum({$<SalesDate = {">=$(=Date(YearStart(Today(), -1), 'DateFieldFormatHere'))<=$(=Date(AddYears(Today(), -1), 'DateFieldFormatHere'))"}>} InvoiceSales)

amit_saini
Master III
Master III
Author

Hi Sunny,

I tried below:

=Sum({$<SalesDate = {">=$(=Date(YearStart(Today(), -1), 'M/D/YYYY'))<=$(=Date(AddYears(Today(), -1), 'M/D/YYYY'))"}>} InvoiceSales)


Sorry no luck!


Regards,

AS

pradosh_thakur
Master II
Master II

=Sum({$<SalesDate = {">=$(=Date(YearStart(max(SalesDate), -1), 'M/D/YYYY'))<=$(=Date(AddYears(max(SalesDate), -1), 'M/D/YYYY'))"}>} InvoiceSales)

Learning never stops.
sunny_talwar

Are you making a selection in the year field or yearmonth or something related?? May be try this

=Sum({$<SalesDate = {">=$(=Date(YearStart(Today(), -1), 'M/D/YYYY'))<=$(=Date(AddYears(Today(), -1), 'M/D/YYYY'))"}, Year, Month, MonthYear, Quarter, QuarterYear>} InvoiceSales)

pablolabbe
Luminary Alumni
Luminary Alumni

When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads as HELPFUL if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads as HELPFUL if you feel additional info is useful to others