how to determine if 2 line graphs with different values are same - database

I'm trying to compare line graphs with completely different values and scale.
On X-axis i have values from 0-30 (Days) and on Y-axis i have stock values.
My task is to compare the data of last 30 days with a huge database which already contains different stock values.
is there any way to compare the shape to 2 graphs irrespective of what values were used in y-axis?
Thanks in advance
First Graph
Second Garph

Related

How to multiply values within a nested array...times values in an another array (in Google Sheets)?

This is hard to explain so my title sucks, and is just my best guess at how I might be able to approach this. I have a Google Sheet of sales data for cases of various bottle sizes of kombucha. Column E is the sale date, Column G contains the item code, and column J is the quantity sold of said cases. See my (vastly simplified) sample data:
https://docs.google.com/spreadsheets/d/17-LzGrNJtBr-FwOZtdaoCws3ayeGOHu_TdtGOfXj4cA/edit?usp=sharing
See my current test code below (also present in the Formula tab of the linked spreadsheet). It successfully gives me the combined number of cases sold of half-liter bottles and Growlers. The values in E4 and E5 are cells containing my start and end dates, respectively, so I'm constraining the results only to those which fall within a certain date range.
This code works, but now I need to figure out a way to sum the total number of bottles sold instead of # of cases. The data set is already massive and pushing the limits of google sheets, so adding a column to the source data sheet with # of bottles per case is not an option. Half liter cases hold 13 bottles, and growlers hold 5. Is there any way to do this with my current approach, using another array perhaps? Or any other approach that keeps the formula as simple as possible?
FYI the current formula is a proof of concept and I will be adding many additional types of cases to the existing formula, each containing a different number of bottles per case, and using it as part of a larger dynamic formula that allows you to switch between showing # cases vs # bottles vs # of actual liters sold, so this is why I am hoping to find an array-based approach that will let me do this without needing to resort to an absurdly long and complex formula of nested IF statements.
=SUMPRODUCT(--((XeroInvoiceData!$E$3:$E>=B4)*(XeroInvoiceData!$E$3:$E<=B5)), (--(ISNUMBER(MATCH(XeroInvoiceData!$G$3:$G, {"HalfLiterCase","GrowlerCase"}, 0)))), XeroInvoiceData!$J$3:$J)
I would be eternally grateful for any assistance.
Here is my solution:
https://docs.google.com/spreadsheets/d/1ig0krumJu4Lj9-nIKJyRfPLTYbU-mzOL0JokRUDEqNc/edit?usp=sharing
My idea was to filter your table on date and sum by the type of container.
I wanted also to allow new types of containers that contain smaller units (bottles or liters).
I divided this job into 3 stages.
First we have to filter this table according to selected dates and container types.
I prepared a list that may be extended (all you need is to extend the filter range).
Then I have to vlookup values of units in each container and I try to do it inside the same formula.
General idea is
={[query results],arrayformula(ifna(vlookup([first column of query],$C$21:$D$26,2,0)*[second column of query])}
I divide it into 2 stages.
First stage referrs to query results in adjacent table:
Second stage uses indexes of query so formula is quite long:
Tell me if it solves your problem.

Using multiple dataset in the same chart with different values

I am using react-chartjs-2. I have a Line chart and x: time y: value. I have 2 different dataset. First dataset value is very as low as 0.00000145 and etc. The second dataset value is as high as millions. When i use this in the same chart, first dataset is at the bottom and looks like a single straight line as chart comparing 2 datasets. Time is same for both datasets. So what is the best way to see two different datasets self comparing?
I think, the best way is to make single chart, which will show correlation between two datasets - the division of first dataset's values by another's. I think, it may be representative

SSRS - Display only Top N Category Groups excluding duplicate groups at the end in Bar Chart

Consider the following table
I need to generate a bar chart with the Category Group = "Country". The chart should only display the top 3 Groups based on the count of records for a country. I have already applied a filter for the Category Group specifying the Top N Condition as 3 for Count(Country). The chart generated, applies the filter as expected based on count, but i need only 3 bars to be shown even if there are bars with duplicate values.
Below is the chart that I get.
Expected Result
Now I know that, i can create an additional column in my dataset with ranking values and then apply a filter on this column to get the expected result (i have tried this, and it works)
Is there a way to achieve the expected result without changing the underlying Dataset?
Note: The dataset shown above is a highly simplified version of my dataset. In reality i have a huge dataset with a lot of columns. The same dataset has been used for various charts (with groupings on different columns).
This was an interesting question as I've always just "solved" the tiebreaker in the dataset without much thought. However, I do see a fairly easy way to use the rnd() function to dissolve the ties as long as you don't care which of the tied countries is shown:
=(Count(Fields!Country.Value) * 1000) + (Rnd() * 100)
Which essentially just weights the count per country into the thousands and then tiebreaks with a random small value:
New York: 30XX
France: 20XX
China: 10XX
Italy: 10XX
Singapore: 10XX
If you wanted to actually solve the tiebreaker with an alphabetical preference, you could do something similar but incorporate the numeric value for the first letter of the country etc...
I just found out, I could use an x-axis minimum of 0 and an maximum of 10.5 together with an interval setting of 1.
So, I was able to achieve a top 10 limitation and the axis labels show the names - (it may be a side effect but when I changed the axis maximum to a whole number, the axis no longer shows the names but numbers).
I was not really happy with the other approaches. They seems much of an overkill to me for such a simple requirement like limiting the number of bars shown in a chart.

ST_Split returning a huge amount of rows

I am attempting to split a small road network at every intersection. I started by creating points at every intersection in QGIS, that was no problem. But now I am trying to split them using PostGIS and I am getting back 16000 rows, which is far more than reasonable. I also checked and saw that there are many duplicated in the returned table.
I am not enormously experienced in PostGIS so it's likely that I am making a key mistake that I just can't see.
This is my query:
SELECT ST_AsEWKT((ST_Dump(ST_Split(streets_network.geom, nodes.geom))).geom) AS the_geom
FROM streets_network, nodes
You're trying to split all streets using all nodes... as output you'll get at least count of nodes multiplied by count of streets...
You have to add to this value count 2xnodes intersecting with roads... if you have 1 road with 3 cutting nodes you'll get 6 pieces (as 2 splited in first point, 2 splited in second point and 2 splited in third point)
With a high probability it will not work at all cause of accuracy and roundings in database - it's almost impossible to hit to a line with a point which, by definition, is infinitely small.
As resolutions:
You have to cut the line only with points intersecting with it
Cut line with union of all points intersecting this street - one geometry with one (multi)geometry, so cutting with 3 points you'll get 4 lines.
Use ST_Buffer with some minimal value to expand points into very small circles
Or else.... use pgr_nodeNetwork() function from pg_routing extension

Plot data in highcharts according to the timestamp of the data

I have a database that holds two columns. One is a 'count' field and another one is the 'timestamp' field of each count. I want to plot this data in the highcharts using a line graph. The x-axis of the graph is marked from 1-24 that corresponds to 24 hours in a day. Now the problem comes when the graph starts plotting. I want the timestamp of the count to correspond with the hour on the x-axis. So if the count starts from 14:00:00, the graph should start plotting from 14 on the x-axis leaving the first 13 points on the x-axis blank. But the graph is starting every time from 1. Thus not corresponding with the timestamp of the count in the database.
Can anyone help me out with this? I tried using data formatter and x-axis formatter, but couldn't figure out how to do it.
Thanks in advance

Resources