Data model for sparse time series data - orientdb

First of all I'm using OrientDB 2.1.4 and I'm building an API to show some graph data series. I have the following dataset of base salary updates:
Person Base salary Period
====== =========== ======
John 1200 201411
John 1300 201503
John 1500 201508
Megan 1000 201410
Megan 1100 201501
Person is class V. I want to know which model type suits me the best to give me the following yearly report for one person to graph (eg. John):
Period Base Salary
====== ===========
201501 1200 <= last updated salary: 1200 in 201411
201502 1200
201503 1300 <= here the base salary gets updated
201504 1300
201505 1300
201506 1300
201507 1300
201508 1500 <= and here again
201509 1500
201510 1500
201511 1500
201512 1500
So far I've tried embeddedLists in Person and LinkedLists, but I can't figure out how to retrieve the last known value of a base salary for a period which has no linked data.
The best I've achieved so far is to model Period and BaseSalary as class V, and creating edges between them: Person -> BaseSalary -> Period eg. John -> 1200 -> 201411, but still don't know how to get the value 1200 between periods 201411 and 201502 using this model.
Any suggestions?
Thanks,
Rod

Related

Crystal reports subtrack running total

I want to create a formula for running total subtract sales from opening stock. I have database fields for Opening stock and sales. From opening stock I have to subtract sale and show from second record
For example:
ID openingstock sales Stockonhand
--- ------ ------- -------------
1 500 10 500
2 5 490
3 10 485
4 3 475
5 5 472

grouping rows data in tableau and get the result

I have a table in tableau
store year project store_amount
1 2012 p1 1200
1 2012 p2 1200
1 2012 p3 1200
2 2019 p4 1700
2 2019 p5 1700
3 2012 p6 2900
What I want in tableau is total store amount by store id, so it should show 1200 for store 1, 1700 for store 2, 2900 for store 3
And when I want to see the total store amount I want the sum of store 1,2,3 , 1200+1700+2900
Another grouping I want to do is by year: So for 2012 it should be (1200+2900)
I tried a lot of ways but can't do it.
There are a number of options, it basically depends on the specifics of what you're trying to do. Based on you wanting so sum the total across all stores and also group by year try the following calculated field formula:
{ FIXED [Store]:MIN([Store Amount])}
Sum this new field - in other words it's the sum of the minimum (or max or average - based on your data it doesn't matter) values

Complex Spotfire Join

I am attempting a complex join. I have tried a Left Outer, Left Single, Full, Inner, Right Outer and Right Single and none of them have produced the result I need.
I feel it might be easier to explain with Pictures so here it goes. In Pic 1 you can see my main Data Table Total Sales_2.
What I want to do is bring in the Value column from ROI RUBU Schema see Pic 2 for the corresponding Product on the corresponding Schema into Total Sales_2
So in Pic 1 you can see I have a line highlighted in green. It has its account number TY00009, its Schema Name ROI_RUBU_SCHEMA_8, the product number 156118, the product name, Estrumate 1x20ml 195, the Qty 10 and the Total Value 424.50
what I would like to see in the next column in Total Sales_2 is Value and 0.20 but I don't get that see Pic 3
I have used and a Left Outer join in this example placed on the Product code to bring in the Value Column from ROI RUBU Schema see Pic 2 into Total Sales_2
I was expecting to see 0.20 as I have a line highlighted in green in Pic 2 because ROI_RUBU_SCHEMA_8 gives back 0.20 for product 156118
As you can see in Pic 3 I get different values back for Product 156118 on ROI_RUBU_SCHEMA_8 See Pic 3
What I need is the value to be 0.20 for all on Product 156118 on the account TY00009 because its on ROI_RUBU_SCHEMA_8
If TY00009 was on ROI_RUBU_SCHEMA_9 I would expect to see 0.27 for Product 156118 as that is what ROI_RUBU_SCHEMA_9 gives back on Product 156118 again see Pic 2 ROI RUBU Schema
I have tried every join there is available and no luck. If anyone can offer any help it would be greatly appreciated.
Pic 1
Pic 2
Pic 3
So based on feedback from an administrator please find what I believe to be a useful amount of data that can be used to recreate what I am currently facing. If more data is needed I am happy to supply
Total Sales_2 Data
Customer Maxx name Customer Maxx Code Schema Name Product Code Product Description Sold Quantity Total Value
Random Customer Name TY00009 ROI_RUBU_SCHEMA_8 156118 Estrumate 1x20ml 195 10 424.5
Random Customer Name TY00009 ROI_RUBU_SCHEMA_8 119977 Rotavec Corona 1x40ml 125 30 5222
Random Customer Name TY00009 ROI_RUBU_SCHEMA_8 30179 Bovilis BVD 1x25ds 195 3 424.5
Random Customer Name TY00009 ROI_RUBU_SCHEMA_8 21406 Delvosteron 1x20ml 125 6 5222
Random Customer Name TY00009 ROI_RUBU_SCHEMA_8 13262 Dexafort 1x50ml 195 4 5222
Random Customer Name TY00009 ROI_RUBU_SCHEMA_8 156118 Estrumate 1x20ml 195 12 4444
Random Customer Name TY00009 ROI_RUBU_SCHEMA_8 119977 Rotavec Corona 1x40ml 125 32 3333
ROI RUBU Schema Data
Product Number Product Name List Price Oct 1st 2018 Category Value
156118 Estrumate 1x20ml 100 €28.50 ROI_RUBU_SCHEMA_8 0.2
156118 Estrumate 1x20ml 100 €28.50 ROI_RUBU_SCHEMA_9 0.27
156118 Estrumate 1x20ml 100 €28.50 ROI_RUBU_SCHEMA_10 0.16
So I finally got there, and I wanted to give the answer so that it may help others.
It was simple really and silly on my part. It was a left outer join that was needed, but I only bought in 1 Column Value from the ROI RUBU Schema table, so when I saw all the different values for ROI_RUBU_SCHEMA_8 on data table Total Sales_2 Data i thought the join was wrong.
If I had of also bought in the Category Column from ROI RUBU Schema table into Total Sales_2 I would of seen all the possible Schema. I simply did not bring in Category Column from ROI RUBU Schema table. Silly but it happened :-)

Tableau stacked and side-by-side bar chart on column aggregation

I have a data set like this
Name Occupation Payment Principal Interest
Amy Nurse 100 90 15
Becky Teacher 80 100 20
Catherine Nurse 90 75 15
John Engineer 90 80 12
Tom Teacher 120 100 20
... ... ... ... ...
I'd like to create side-by-side(Payment) stacked chart:
Row: Occupations
Column1 : stacked(Sum of Interest and Sum of LP Principal) by occupation
Column2 : Only Sum of LP Payment by occupation
Can anyone give me hint how to make it?
Your data is not in the correct format for the required chart and you need to do some data prep.
Pivot all three measure fields from the data source page.
create a calculation to define the column for each data type
Build the chart as below and hide the header for column field.
One approach that avoids reshaping your data is to use the measure names and measure values placeholder fields to create the stacked bar chart.
See below

How to Sum values of column corresponding to one column in jasper

In jasper i have one requirement like, sum all the data of the column based on another column. I know how to show sum of all the data in the column. But please suggest me for this requirement.
Emp-Category Emp-Id Salary
---------------------------------------
Cate - A 1 128
2 50
3 89
total 267
Cate - B 4 123
5 50
6 100
total 273
Total Expenses 540
So there will be many number of categories, which will be getting from database.
Please suggest me how to do this approach.
In that case, you can use groups...
You can refer to the link below for tutorial :)
http://www.tutorialspoint.com/jasper_reports/jasper_report_groups.htm