Linking Table Widget to ColumnDataSource - datatable

I am working on a first-order rate estimator. This estimator consists of a plot displaying measurement data, and the solution for the objectively best first-order rate law. The user should be able to enter their data in a table next to the plot. A button will trigger a JS callback that takes the input data from the table and computes all necessary steps and finally exchanges the data from the plot with the newly computed ones.
I was not able to find a Table widget with easy data input, i.e. not entering all values one after one, but rather copy-pasting an existing table into the widget.
So my first question is: is there such a widget available in bokeh?
the second question is: If there is such a widget is there a way of replacing the content and thus the size of a Columndatasource with user input data?

Related

How to create a DAX cross-sectional measure?

I don't know if I even worded the question correctly, but I'm trying to create a measure that depends on what is showing in the pivot table (using PowerPivot). In the image I posted, "DealMonth" is an expression in the PowerQuery table itself that simply takes the start date of the employee and subtracts it from the month a deal was closed in. That will show how long it took for that salesperson to close the deal. "TenureMonths" is also an expression in the PowerQuery table that calculates the tenure of the person. The values populating this screenshot are coming from a total headcount measure created. What I'm trying to do is create a separate measure that will show when the "TenureMonths" is less than the "DealMonth." So if the TenureMonths is 5, then after DealMonth of 5, the value would be 0. Is this possible?
Screenshot
I should add the following information.
"DealMonth" - Comes from the FactData table
"TenureMonths" - Comes from the DimSalesStart table
These two tables are joined by name. I feel like I'm so close because I can see what I want. The second image below is a copy/paste of the pivot table result but with my edits to show what I'd want to have shown. Basically, if(TenureMonths >= DealMonth,1,0). The trouble seems to be that since they're in two different tables, I can't make it work. The rows in the fact table are transactions, but the rows in the dim table are just the people with their start and end dates.
Desired Result
This is possible with some IF([measure1]<[measure2],blank(),[measure1]), however without seeing more of the data it will be hard to guide you specifically.
However you need to create two separate measures, one for TenureMonths and one for DealMonth, depending on the data this can be done with an aggregator forumla such as sum, min, max, etc (depends if there will be more than one value).
Then reference those two measures in the formula pattern I mentioned above, and that should give you want you want.
I figured out a solution. I added a dimension table for DealMonth itself and joined to my fact table. That allowed me to do the formulas that I needed.

Excel 2017 Formula - Average data by month, while being filterable

I'm not a VBA coder, and I would prefer an excel formula if possible, the easiest solution will be the best one.
Test workbook screenshot
As you can see, I have plenty of columns, which are filterable.
I am attempting to retrieve an average of Column L, but I want the data to be calculated for the correct month in G3:R3.
The resulting calculation needs to be recalculated when filtered, between customers, sites, status, job type etc.
I am referencing the resulting cells in another sheet, which gives an idea of trends I can glance at, as such filtering by month in each sheet, is not an option.
=AVERAGE(IF(MONTH(E9:E1833)=1,(J9:J1833)))
This one does not update with the filtered data.
=SUM(IF(MONTH(E9:E1833)=1,J9:J1833,0)) /SUM(IF(MONTH(E9:E1833)=1,1))
This one does not update with the filtered data.
I have tried 5 different SUBTOTAL formulas, some with OFFSET, none of these produce the same result I get when checking manually.
Each worksheet has over 1,500 hundred rows, the largest is 29148 rows. The data goes back as far as 2005.
Please can someone help me find a solution?
One possible solution is to create a helper column which returns 1 if the row is visible and returns 0 if the row is invisible (or blank). This allows a bit more freedom in your formulas.
For example, if you want to create a helper column in column X, type this into cell X9 and drag down:
= SUBTOTAL(103,A9)
Now you can create a custom average formula, for example:
= SUMPRODUCT((MONTH(E9:E1833)=1)*(X9:X1833)*(J9:J1833))/
SUMPRODUCT((MONTH(E9:E1833)=1)*(X9:X1833))
Not exactly pretty but it gets the job done. (Note this is an array formula, so you must press Ctrl+Shift+Enter on your keyboard instead of just Enter after typing this formula.)
With even more helper columns you could avoid SUMPRODUCT altogether and just accomplish this by doing a single AVERAGEIFS.
For example if you type into cell Y9 and drag down:
= MONTH(E9)
Then your formula could be:
= AVERAGEIFS(J9:J1833,X9:X1833,1,Y9:Y1833,1)
There isn't a clean way to do this without at least one helper function (if you want to avoid VBA).

Filter Data for Each Row in a Column

EVE Online Manufacturing Spreadsheet
In Batch!F3:G, I'm attempting to break down the data input from columns B3:C to their components (and eventually materials/minerals in I3:J) by using filter to compare results in Engine!P:R. Multiplied of course by the total number of each finished product I need.
I've been trying to figure out ways to arrayformula this together, and even tried quite a few query functions without success. The best I've been able to come up with is to string the actual formula together, appending them with {}, but this gets bloated quickly. I need this to be open ended because I have a tendency to build a lot of things at once. Any help would be appreciated, even just point me in the right direction!
Well, based on my limited knowledge about google sheet, I can only think of one way to do this automatically.
Here's a sheet I constructed based on your sheet.
https://docs.google.com/spreadsheets/d/1AfX8o05gUGPiN5S90w4o0yxuIYjsJRaXsaYUFTJuEPo/edit?usp=sharing
First, on Engine sheet, add one more column which will give you the number of materials required for that part, which is looked up in the PART LIST of BATCH sheet. For this I use VLOOKUP, as you see in D2.
Then on BATCH sheet, query the materials that VLOOKUP return positive, multiply it by the amount of item and then sum them.
This is done by the QUERY used in F3
This method only if you don't have duplicate item in your PART LIST, due to the way VLOOKUP work.
Of course if you want to break the material list further, you can do the same approach..

Tableau calculated-field filter on pie-chart doesn't work

Based on previous question, I had to create calculated value for Location, and use that as quick filter, i.e.
Location Filter:
LOOKUP(ATTR([Location (Loc)]),0)
Workbook is on Public Tableau
For hovering over points in a map, the calculated field works, but when I create pie chart, it doesn't work.
For instance, if I select All, this is the result
And if I select a business from Location Filter, this is what I get
How to troubleshoot?
Additional Info
However, if I use regular Location filter, then it works, i.e
There are two separate issues to address here:
LOOKUP(ATTR([Location (Loc)]),0) is a sneaky way of filtering the data in the view while still maintaining all of the locations in the partition (by disguising the field as a table calculation, the filtered partition is created before this table calculation is ever executed). Because you've used it here, you still have every location in the partition, even when you filter them out with the quick filter. Because they're still in the partition, when you calculate the percent of total, those other locations will be included in that total, even if they're not displayed in the view.
I don't see a reason for you to keep all of the locations in your partition in this case, so I'd just replace that filter with [Location].
It looks like you've dragged [Location] into your mark as a dimension. As a result, it's broken up the pie slices into smaller chunks, one per location. If you add a dimension to your data, then Tableau will have to group by that dimension when calculating the aggregations.
If you want the Location to appear in the tooltip of your pie chart, you'll have to either add it as an attribute (in which case you'll have to deal with the "*" when you have more than one location in the partition), or you'll just have to deal with the slices being broken up further.

Search help exits: How to set initial parameters on the Search Help select-options, and customize the data selection? (both, not just one of these)

My problem is this:
I want to trigger a search help programatically.
I want to populate the initial select-options screen with default values (and set some as non-editable).
After the user choses aditional parameters (or changes the existing ones) I want to be able to implement the data selection logic myself.
My approach is using a search-help exit.
I've managed to fill in the initial select-options parameters, but then I couldn't modify the data selection logic. For this I filled the SHLP_TAB[]-INTERFACE table with data, and kept the CALLCONTROL-STEP = 'SELONE'.
I've managed to be able to be able to modify the data selection logic, by setting the CALLCONTROL-STEP = 'PRESEL'. but then I couldn't populate the initial screen with data either by filling the SHLP structure (INTERFACE table of it) or the SHLP_TAB table (same INTERFACE) component.
I want to both populate the initial screen, and control the data selection. (How) can this be done?
[EDIT]
*SOLVED*
The problem was that I was using an exit function module for a collective search help that I was calling.
This works differently from an elementary search help exit function.
The collective search help does indeed supply the parameters (thorugh the defined binding) for the PRESEL event, but the SELECT event is then performed in the elementary search help.
The Collective search help SELECT event is apparently called after skipping the PRESEL events of the elementary search helps, so that is why one should be careful when to use exit functions for either the Collective search help, or the elementary search help.

Resources