Trying to find a solution (pivot view??)
I have a simple trading journal database. My main form collects initial trade data with opening "trade date". I have a sub-form in that form to collect data for any further adjustments to that particular trade.
My problem: Generate a chart or field that summarizes ALL my generated income for a given day (ie "Total Premium" from main form AND any generated "Roll Premium" from the sub-form)
When I try a pivot, I'm unable to get both sets of data into it. When trying to generate a field to calculate the data, I'm unable to figure out proper formula.
I have successfully and happily created all the other main metrics I need for the database except this one. Any help would be immensely appreciated.
14 replies
-
I can't make a comment on pivot tables, but to get values from your child table is easy.
At the parent level, you can create a formula field, we can call it 'Total Roll Premium', with:
sum('Close or Roll Data'.'Roll Premium')
Then another formula to add the two fields together:
'Total Premium' + 'Total Roll Premium'
-
Thanks for your reply. Yes, I have that field created and it works great. However, I'm looking to get ONLY the sub-table data that matches a specific date. Any ideas?
-
To filter reference links you would use the double brackets [ ].
If we use your pics from the original post then I guess it would look something like:
let t := this; sum('Close or Roll Data'['Close or Roll' = t.'Trade Date'].'Roll Premium')
But first you need to gather the current record into a variable using the 'this' function.
Then you can you use that variable to reference any field in the parent record.
I can only see the column name 'Close or Roll', so I don't know if that is the full name. Please modify it with the full name if needed.
-
Thanks!! I'm trying to understand this scripting, but keep running into road blocks. Based on your answer, I get the following errors:
-
Why did you add the select command in there? We are using the reference link to get your data. With more info here is what it should look like:
let t := this; sum('Close or Roll Data'['Close or Roll Date' = t.'Trade Date'].'Roll Premium')
For educational purposes we can troubleshoot the image.
The reason you are getting the error is because you don't have a reference field called 'Closed-Roll Data' in your table 'Closed-Roll Data'.
-
REALLY appreciate your help with this!!!
I thought I needed to use the "select" to get the data since it didn't work without it either.
Entered the code you suggested and get this error:
-
Oops, I misread the initial image. Just change the 'Close or Roll Data' to match your field name 'Closed-Roll Data'.
-
said:
The "Trade Date" in my Trade Details table (and in the "Income by Day" view I'm trying to create) is the "opening date" of a NEW trade.I don't see a field called "opening date" in the Trade Details table. I don't know where that 05/10/2023 date is coming from since it does not show up in the Trade Detail form view.
In your table view for Trade Detail table where is the data for the Trade Date column coming from? Was this column name changed from the default?
You have to match the correct fields. It looks like you want to find records in Closed-Roll Data that matches 05/10/2023, but the field called Trade Date has data of 04/03/2023. You need to figure out this difference.
-
Back to it today, and I created a new formula field in the sub-table and can get my "income by day" for the sub-table. Already able to get income by day from main table (trade details as above). Why is there not a way to easily combine these two???
The third screenshot shows my attempt at including the newly created sub-table field, but it will only give me the info for individual trades on a matching date which makes me have to manually calculate what really went on for the whole day. Also when adding a sub-table field, why only the choices of first, last, min, max, etc??
Ninox being a relational database, I would think creating reports that allowing querying of data and displaying that data in reports or charts would be easier. I've watched the tutorials many times and am working to understand the scripting, but I'm still missing a huge piece of understanding here. Thanks again for help and feedback (especially )
-
said:
Why is there not a way to easily combine these two???You just need to follow my comments from earlier replies. If you are in Trade Details table then you can create the following formula field:
sum('Rolls-Closed Details'.TRollPremium) + 'IncomefieldName'
Also when adding a sub-table field, why only the choices of first, last, min, max, etc??
That is because you are trying to add data from a table that has could have many records. So Ninox asks how you want to deal with that issue. Do you want to show the first, last, min, max, or concatenate?
I would think creating reports that allowing querying of data and displaying that data in reports or charts would be easier.
One trick is to start using dashboards to do your data mining. I found trying to make views in the raw data tables was a frustrating and hopeless endeavor.
Content aside
- 1 yr agoLast active
- 14Replies
- 169Views
-
2
Following