Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
warrenpress
Contributor III
Contributor III

Displaying sales TY vs LY in a chart

Hi,

I need to display TY sales by day vs LY sales for the corresponding day LY as defined in a calendar.

I need the chart to be displayed as follow

pic1.PNG

But I can only get QV to display as follows

pic2.PNG

sample data & QVW attached.

Thanks in advance

3 Replies
effinty2112
Master
Master

Hi Warren,

Try:

Calendar:

LOAD seq_id,

     Date,

     Week_Start,

     Week_End,

     Year,

     Week,

     Date_LY

FROM

[ty vs ly example.xlsx]

(ooxml, embedded labels, table is calendar);

MappingLYDate:

Mapping

LOAD

Date,

Date_LY

Resident Calendar;

Sales:

LOAD

Date,

     Sales

FROM

[ty vs ly example.xlsx]

(ooxml, embedded labels, table is sales);

Left Join(Sales)

LOAD

ApplyMap('MappingLYDate',Date) as Date,

Sales as LY_Sales

Resident Sales;

Gives:

Date sum(Sales) sum(LY_Sales)
9599 9140
02/10/201614611353
03/10/201619491732
04/10/201612741403
05/10/201616281412
06/10/201618121856
07/10/201614751384

Cheers

Andrew

BTW generating random data in the excel sheet is fine but suggest you copy and paste over with values before uploading.

sunny_talwar

Another option would be to change your dimension to this

=SetDateYear(Date, Max(TOTAL Year))

Capture.PNG

Anonymous
Not applicable

Hi Andrew,

I like this solution, but how would you deal with real world challenges like e.g. order no. which unique for each order ?

If I am not mistaken, this approach would actually show Sales and LY Sales for each order no. as well, right ?

Would you recommend just aggregating data to a certain level and then joining the LY values ?

Thanks

Kristina