Jump to content

[solved] Group by date in scatter plots


Andrea Quinci

Recommended Posts

Good morning to everyone.

I have a scatter plot in which I am plotting some data already grouped by month. The problem is that I want a time filter that sums the values in the scatter plot based on what I select. Actually, I have seen that the "Group by marked categories" already exists but it does not work if I need to change the time filter to perform different analysis. Furthermore, the operation of "Sum" applied on my data executes a sum for each point in the scatter plot, giving the same number of points but at the same level.

Thanks to all ones will give attention to this question.

Andrea

EDIT 2019/03/08 02:19 PM: example provided in the attachments.

EDiT 2019/03/08 09:23 PM: solving template in the attachments. I solved the problem by using again the command "Group by marked categories" but -- having set up the right timespan filter --specifying "Current filtering only" in the X-axis and Y-axis settings. The next point was that I need to aggregate both X- and Y-axis, and I was aggregating just the Y-axis.

Link to comment
Share on other sites

First of all, thank you for your answer.

 

I could not share with your an example because they are confidential data. Anyway I can provide an example; the data are in the format:

 

YEARMONTH (string type YYMM), PART NUMBER (string), VALUEY (real), VALUEX (real)

 

In this way I can plot a single point for each couple year/month, namely for each month. The problem is that I need to group (i. e. to sum) the value for the dataset I decide to plot, maybe with a time slider.

 

Thank you for your time, Gaia.

 

Andrea

 

 

Link to comment
Share on other sites

sure but I need to see what kind of plot you already have, it does not take long to make up some data, it is the plot I would like to see. Time as a string of month and year is not an actual date, so I dont understand what your time filter would do, and you mention separating month from year.

 

A sample dxp would actually save me a lot of guessing and typing time

 

Gaia

Link to comment
Share on other sites

Good afternoon again, sorry for the delay.

 

Here I have provided an example: if you open the *.dxp you can see a plot in which we can get the value of Y for each single month. I would like to have, based upon the timestep selected in "year_month", just ONE point which represent the sum of all values over the months selected. If I change the slider I need this single point to move to a new sum made upon the new timestep selected always in "year_month".

 

Thank you again for your patience and your assistance.

 

Andrea

Link to comment
Share on other sites

Hi

I see the initial plot (I guess you wanted the x axis to be year_month, not x). If you aggregate only y, you still have the same x axis and so you still see multiple points, as you noted. Unlessyou also change the x axis to represent the time range.

If you do so, you will see a plot that contains a single dot with a single value of x and y.

You can do that by defining the following custom expressions

For Y axis: Sum([y]) over (All([year_month]))

For X axis: Days(Max(DateAdd("day",1,[year_month])) - Min([year_month]))

Days(..) turns an object of type TimeSpan into a number of days.

DateAdd(..) adds 1 to the max date to include the start day in the difference.

That plot with one dot is not doing much to justify its existence, I added a cross table below as an alternative. The axes are:

Horizontal: None

Vertical:

Same as before but surrounded by as it needs to be categorical for cross-table to accept it. Remember to click on Settings" and choose "Current filtering only", to make it react to filtering.

Cell Values:Sum([y])

 

Gaia

Link to comment
Share on other sites

Hi Gaia,

 

thank you for your reply. Actually, the problem was different: I want data in both the X- and Y-axis, but I need the sum of that value in the timespan I have selected, as is done in the "solved.dxp" attachment. You were right, I need to aggregate both axis to obtain a single value, and so I do. See my EDIT for further details on how I have solved my issue.

 

Thank you anyway for the time you spend trying to solve this issue.

 

Andrea

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...