Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
IEgiluz
Contributor
Contributor

YTD vs LYTD

How can I compare mobile year sales?


I would like to be able to compare the sales of the last 12 months (YTD) against the previous 12 (LYTD).  Since the last date inserted.

Data and sales

 

2 Replies
Yoshidaqlik
Creator II
Creator II

Hi

try:

YTD
sum(
	{<
		date_dim = {">=$(=YearStart(MAX(date_dim)))<=$(=MonthEnd(MAX(date_dim)))"}
	>}
	sales
)


LYTD
sum(
	{<
		date_dim = {">=$(=YearStart(MAX(date_dim),-1))<=$(=MonthEnd(MAX(date_dim),-12))"}
	>}
	sales
)

 

Regards

YoshidaQlik https://www.youtube.com/channel/UC1I9P8MqCZEhB6Nw3FdSqng
Yoshidaqlik
Creator II
Creator II

Did the expression work?

YoshidaQlik https://www.youtube.com/channel/UC1I9P8MqCZEhB6Nw3FdSqng