BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Jeffery_Porter
Obsidian | Level 7

Hello and good morning!

 

I wanted to know if anyone could spell out how I can go about creating a timeline to express year over year differences. I imagine it is something that is simple and I have just been looking in the wrong places. What I mean is I would like to have a chart that goes from:

Jeffery_Porter_0-1683641134815.png

To:

Jeffery_Porter_1-1683641197417.png

Please forgive my horrible drawing.

 

Thank you for your assistance!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Sam_SAS
SAS Employee

I think you want to visualize it like this, right?

 yoy.png

 

The quick calculation for YOY growth is super useful! But to visually compare the two years' data you will need to make a calculated item using the ParallelPeriod() operator.

 

This operator has a ton of parameters, but just refer to the doc and the tooltips 🙂

 

Here is the expression I used for the chart above:

yoy2.png

 

This expression returns the value for the same month of the previous year, so you can take this calculated item and plot it alongside the original measure.

 

Let us know if that helps!

Sam

View solution in original post

11 REPLIES 11
RobbyP
SAS Employee

Hey Jeffrey,

 

For YoY, use the Quick Calculation available from the Data Pane - https://go.documentation.sas.com/doc/en/vacdc/v_018/vareportdata/p1vsphor4qnevcn13p4bepmj5wwx.htm

 

-Robby

Sam_SAS
SAS Employee

I think you want to visualize it like this, right?

 yoy.png

 

The quick calculation for YOY growth is super useful! But to visually compare the two years' data you will need to make a calculated item using the ParallelPeriod() operator.

 

This operator has a ton of parameters, but just refer to the doc and the tooltips 🙂

 

Here is the expression I used for the chart above:

yoy2.png

 

This expression returns the value for the same month of the previous year, so you can take this calculated item and plot it alongside the original measure.

 

Let us know if that helps!

Sam

Jeffery_Porter
Obsidian | Level 7

Thank you very much Sam_SAS that was wonderfully helpful!

 

I was wondering if you have ever run into this before? I am seeing the months from 1960 which I am assuming is some sort of error in the calculation, here is the calculation from 2022 and 2023:

 

 

YoYerrtor.png

Sam_SAS
SAS Employee

SAS dates are stored as numbers based on January 1960, so I think somewhere along the way you are using numerics as dates.

 

Is it possible you are using the wrong variable for the date?

Jeffery_Porter
Obsidian | Level 7

It is very likely, I will look into this and see what I did on my end!

Jeffery_Porter
Obsidian | Level 7

The solution a mistake on my end, I had only the Month Displaying and not MMYYYY.

 

I have one last question and Need a little more guidance, for some reason I am getting 2 datapoints for each month, is there a way to ensure it just shows 1 month for each point?

Jeffery_Porter_0-1683740107987.png

 

Sam_SAS
SAS Employee

I'm not sure I understand -- you want to display a line chart with two lines, right?

Or did you just want to chart the difference? You could use the quick calculation if so.

Jeffery_Porter
Obsidian | Level 7

No problem!

 

At the bottom of the chart, you see each month is listed 2 times, for example, one is on April 1 and the other is April 16th, then March 1 and March 16th.

 

Is it possible to just have "April" and "March" listed only 1 time?

Sam_SAS
SAS Employee

Ah! You want the ticks on the horizontal axis to only be 1 per month. I think the actual data for the chart only has 1 value, but two axis ticks are shown.

 

If you set the format on your date variable to be a month format like MMMYYYY, that should do the trick.

 

VA doesn't like to let you change the format of a variable when it is used in a calculation, so what you might want to do is:

1. Duplicate the existing variable and set the desired format

2. Edit your calculated item and replace the variable with the duplicate.

3. Replace the variable in your chart with the duplicate.

 

That should work, and be less of a pain from deleting everything that uses the variable and re-creating it.

 

Sam

Jeffery_Porter
Obsidian | Level 7

Hello! I was out of the office! thank you for your response.

 

I found the solution and as silly as it was, it was just because the widget was too large, once I shrunk it down I only had 1 data point for each month.

 

Have a wonderful day!

Sam_SAS
SAS Employee

Thanks for letting us know!

 

The axis tick values are automatically thinned when the report is displayed at a smaller size. But changing the date format should ensure that only a single tick is displayed per month, regardless of how large the report object is displayed. I would recommend this if it is important to you and you are not sure how consumers of the report might display it.

 

Thanks,
Sam

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Tips for filtering data sources in SAS Visual Analytics

See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 11 replies
  • 1786 views
  • 0 likes
  • 3 in conversation