Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
QlikWorld Online 2021, May 10-12: Our Free, Virtual, Global Event REGISTER TODAY
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