10 Replies Latest reply: Mar 12, 2016 6:51 AM by Hirish V

# Comparing periods in line chart

Hi,

I need to compare sales periods for a product, for a sale period that crosses 2 subsequent years, in a line chart.

On the X axis i have the sales date in DD-MMM format.

The Year dimension is no good because it will not show the sales for 2 years in the same line.

How can i define the correct period dimension in order to compare them?

Thanks!

• ###### Re: Comparing periods in line chart

You can use set analysis in your expression  to filter your date dimension, something like

(assuming that you also have year YYYY in your SalesDate field format).

If this doesn't help, then please post a small sample QVW.

• ###### Re: Comparing periods in line chart

Hi,

Can you tell your Date Format,It Contains Year or not,

Example: DD/MM/YYYY

Then you can have a expression like this,

```Sum({< Date={‘>=\$(=MonthStart(Max(Date), -23))<=\$(=Date(Max(Date)))’}>} Sales )
```

HTH,

Hirish

• ###### Re: Comparing periods in line chart

Dear People,

The business case are selling flights which can be done in a previous year and in the current year.

So it might be helpful to understand.

In case the user select product from previous years then each sale period would be composed of 2 consecutive years which are joined together.

The customer demands that the display on the X-axis would be DD-MMM, because he wants to see a day to day accumulated sales progress.

The original date is DD/MM/YYYY.

Attached is a simple model to demonstrate the issue.

I would like to see the sale period as one line, instead of two for each year.

Thanks!

• ###### Re: Comparing periods in line chart

Ok, can you somehow outline / sketch how you want to show your two year period in this kind of chart, then?

Maybe using a hand-made sketch drawing?

• ###### Re: Comparing periods in line chart

Hi Swuehl,

It would be one line as shown in this chart, but the dates would be in descending order:

for example: November, December (of previous year), and then January, February (of the current year):

http://screencast.com/t/msOZfqfsZJkX

Thanks!

• ###### Re: Comparing periods in line chart

So you probably just want to use SalesDate as dimension (not your ResvDayMonth field), maybe formatted as DD-MMM, but keeping the underlying numeric value.

Then limit your SalesDate using one of the set expressions shown above.

This should show you the year range across year bounderies, with SalesDate shown in chronologic correct order.

• ###### Re: Comparing periods in line chart

Hi,

I still can't figure how the second dimension (Year)  would be correctly generated.

As we see, it should be merged to one period (e.g., 2014-2015).

Thanks!

• ###### Re: Comparing periods in line chart

Hi Swuehl,

I think the solution is to use the year of the flight sold instead of the year from the order date.

This way, each line is drawn correctly:

2016-03-12_1320 - DafnaLe's library

What do you think?

• ###### Re: Comparing periods in line chart

Hi ,

Check this, is this what you required!!,

By creating a Date Field in Script and a Calculated dimension in Chart for only last two years .

```=Aggr(Only({<Year={'\$(=Max(Year))','\$(=Max(Year)-1)'}>} Year),Year)

```

HTH,

PFA,

Hirish

• ###### Re: Comparing periods in line chart

try