Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
bill_mtc
Partner - Creator
Partner - Creator

How to trend Current Sales vs Prev Sales, using date as dimension?

Hi,

I have here one of client's requirement, would this be possible? Can we able to trend in one line chart the Current Sales vs Prev Sales, using Date as Dimension? (see attached file)

sales vs prev sales.jpg

NOTE:

Blue Line Dates are Dec 29, 2013 to Jan 7, 2014

Orange Line Dates are Dec 29, 2012 to Jan 7, 2013

What did is that, only date of Blue Line being used as dimension. This the same as getting Sales Revenue of Same Day of Previous Year.

As far as I'm concern, this is not doable, isn't it? If anyone could help, I would appreciate.

Regards,

Bill

1 Solution

Accepted Solutions
vadimtsushko
Partner - Creator III
Partner - Creator III

Hi, Bill Ringer Salalima

The question is, is it really doable?

I believe answer is yes. I would prefer to use for it AsOfTable approach as in article Calculating rolling n-period totals, averages or other aggregations mentioned by Gysbert Wassenaar in his answer.

I believe it gives results conforming to your requirements.

SalesVsPrevSales.png

Look at example in attachment

View solution in original post

16 Replies
Not applicable

In Line chart , select :

Dimension;  Date

Expression 1; Sum(${<Year = $(=max(Year))>}Sales)

Expression 2; Sum(${<Year = $(=max(Year)-1)>}Sales)

Gysbert_Wassenaar

You can try using two expressions:

sum(Sales)

above(sum(Sales)).

This approach does have some drawbacks. See this document for more information: Calculating rolling n-period totals, averages or other aggregations


talk is cheap, supply exceeds demand
manideep78
Partner - Specialist
Partner - Specialist

Hi Bill Ringer Salalima

Make only date as dimension. (for eg, Jan-2, Jan-3 etc)

Then write two expressions for current year and previous year.

Hope this helps

Regards,

Manideep

bill_mtc
Partner - Creator
Partner - Creator
Author

Let's say

For Blue Line, dates are from Dec 29, 2013 to Jan 7, 2014

For Orange Line, dates are from Dec 29, 2012 to Jan 7, 2013

Is this possible to have this chart? The dimension used is Date in Blue Line.

sales vs prev sales.jpg

bill_mtc
Partner - Creator
Partner - Creator
Author

Hello Manideep,

The client wants to select dates freely, there should be date ranges selection. Say date selected is from Dec 1, 2013 to Jan 31, 2014.

So what will happen in the in line chart is that:

  • Dates to be shown as Dimension is from Dec 1, 2013 to Jan 31, 2014
  • Sales Revenue will get/calculate daily sales from Dec 1, 2013 to Jan 31, 2014
  • Previous Sales Revenue will get/calculate sales from Dec 1, 2012 to Jan 31, 2013


Meaning, data points for Previous Sales Revenue will be within the data points of Sales Revenue.


I know this requirement is kinda tricky, but I hope there's solution on this!



Regards,

Bill

vikasmahajan

Dear Bill,

You require like wise comparison for  current date vs last yr same day date , Please refer demo attached.

Best of Luck.

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
bill_mtc
Partner - Creator
Partner - Creator
Author

Hello Vikas,

I thought attached file could have sample report like what is being required. Anyway, thanks for that info.

vikasmahajan

Dear Bill,

Add this variables in calendar ,

  num(Year(TempDate)&num(Month(TempDate),'00')) as YEAR_MONTH, // Link between tables for previous month / year selection

     num((Year(TempDate)-1)&num(Month(TempDate),'00')) AS YEAR_MONTH_PREVIOUS, // Link between tables for previous month / year selection

     num((Year(TempDate)-2)&num(Month(TempDate),'00')) AS P_YEAR_MONTH_PREVIOUS

Use this variables in set analysis

for CY

SUM({$<FiscalYear={$(=max(FiscalYear))}>} [Sales Amount])

for LY Same Date

( SUM({$< FiscalYear={$(=max(FiscalYear)-1)},YEAR_MONTH=p(YEAR_MONTH_PREVIOUS),[Posting Date]={'<=$(vLMaxDate)'},FinancialYear=,MonthName=>}[Sales Amount])

Hope this helps you

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
bill_mtc
Partner - Creator
Partner - Creator
Author

Hi,

I appreciate your effort but I tried to apply, I'm still getting the same output as mine... The requirement is to have like this output (see image). The question is, is it really doable? As you can see in X-axis, date ranges from Dec 29, 2013 to Jan 7, 2014. So here, two Years are involve.

Blue Line is data of Sales as of Dec 29, 2013 to Jan 7, 2014

Orange Line is data of Sales as of Dec 29, 2012 to Jan 7, 2013


I would more appreciate if you could provide sample report that display like chart below? My apology of posting the same image.

sales vs prev sales.jpg