Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
When i am doing Year to Date comparison with current vs Previous year, I am writing below expressions-
For current YTD analysis->
=SUM({<Year={'$(=Max(Year)'},Date={'<=$(=Max(Date)'}>}Total)
or
=SUM({<Year={'$(=Max(Year)'}>}Total)
Both the above expresssions gives same result to get values for the current year in straight table.
For previous YTD analysis->
=SUM({<Year={'$(=Max(Year)-1'},Date={'<=$(=addyears(Max(Date),-1))'}>}Total)
or
=sum({<Year={$(=Max(Year)-1)}>}Total)
But for the previous YTD analysis, both the above expressions doesnt give same result.
-I understand that because here the second expression gives result for the whole year.
Am i correct?
-While doing YTD analysis for previous year, which above expression should i need to use?
-Also is it important to use Month=,Day=,MonthYear=, in the set analysis in YTD expreesion?
You are right and I think you should use the first one
=SUM({<Year={'$(=Max(Year)-1'},Date={'<=$(=addyears(Max(Date),-1))'}>}Total)
as name says YTD, Year to Date for current year ideally should not be compared to complete previous year.
You are right and I think you should use the first one
=SUM({<Year={'$(=Max(Year)-1'},Date={'<=$(=addyears(Max(Date),-1))'}>}Total)
as name says YTD, Year to Date for current year ideally should not be compared to complete previous year.
you ask "-Also is it important to use Month=,Day=,MonthYear=, in the set analysis in YTD expreesion?"
it depends: if you add list boxes for these 3 fields, selecting in these list box will modify the result of your expressions
if you want to disregard selections in Month, add Month=
same for other fields
Thanks everyone for the clear answers..
for this type of calculation I am getting previous total is wrong ... my straight table is comparing the current year and previous yar...
teacher name current yearsalary previous year salary
for this current year cumulative total salary is coming correct, but previous year total salary is wrong ie cumulative total salary.
any clue.. I posted the information in my new thread
https://community.qlik.com/message/941380#941380