Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
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