Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator III
Creator III

How to create Prior YTD sales calculations

Hi,

I have used the below calculation for prior YTD:

sum({$<[Order Date]={">=$(=YearStart(AddYears(Max([Order Date]),-1))) <=$(=AddYears(Max([Order Date]),-1)"}>}Sales)

and I have attached my application. But for Prior YTD column I am getting no values.

Please help me

5 Replies
Highlighted

Closing parenthesis missing

sum({$<[Order Date]={">=$(=YearStart(AddYears(Max([Order Date]),-1)))<=$(=AddYears(Max([Order Date]),-1))"}>}Sales)

Highlighted
Creator III
Creator III

hi,

I have used your expression, but when I select a year value from select list I got 0 for all the rows for that column. So is anything wrong here or I cannot select year from dropdown?

Thanks,

Sandip

Highlighted

Ignore selection in Year my friend.... Are you unfamiliar with set analysis basics?

Sum({$<[Order Date]={">=$(=YearStart(AddYears(Max([Order Date]),-1)))<=$(=AddYears(Max([Order Date]),-1))"}, Year>}Sales)

Highlighted
Creator III
Creator III

Hi,

I am taking apology for this , but may I know that why I need to use 'Year=' here?

Actually I am using this:

Sum({<Year=,DayNumber=,MonthName=,[Order Date]={">=$(=YearStart(AddYears(Max([Order Date]),-1))) <=$(=AddYears(MonthEnd(Max([Order Date])),-1))"}>}Sales)

So for calculating the MTD and YTD is it will be same?

Highlighted

When you select year 2015, your Order Date range will become 01/01/2014-12/31/2014. So if you don't ignore Year, the two will contradict each other. So, in your case, year selection will indirectly drive your Order Date to give you the right output as long as you ignore selection in Year field.

So for calculating the MTD and YTD is it will be same?

Don't know what you mean here