I am simulating a medical stay and would like to calculate for each patient generated the cost of their stay. I have created a parameter that is updated each time the patient receives care. However, to plot it, I created a histogram data with a cyclic event that updates the values every hour with the following code:
this.CostperPatient.reset();
for (Patient patients: this.patients)
{
this.CostperPatient.add(patients.cost);
}
However, the chart it produces does not give an indication of individual patients, it makes a percentage.
Is there any way to output a graph with the cost for each individual patient?
Thank U
Miriana
While I am not sure what you are trying to show, it seems that in your case, you shouldn't be using a histogram, instead you should probably use a bar chart where each bar is for a patient. To do so, drag to your model in the main environment a bar chart element and call it chart. To dynamically add bars to this element, you need to use something called "data items". For now, remove all data items from the chart by clicking on the X in the properties.
Then, go to the Agent window, so your patients' agent window. Add a variable. Set it as follows:
Then, in the agent's properties, in the on startup field write the following:
Finally, add a cyclic event in the agent's window with the following code:
patientCost.setValue(cost);
Where cost in the above, refers to your initial variable called cost in the question. That should do it.
Related
I've a question, in my main agent I've some variables which I want to export to a excel row based on a parameter value (in this case AGVs) after the simulation duration. Now I want to vary this parameter by using the parameter variation experiment, but somehow it does not work and only updates the excel sheet for the last run. So in the figure below you see the exportdata function which is the function which puts the data in the excel sheet columns.
Now I want to vary a parameter in this example I choose the number of AGVs, so I created an parameters variation experiment and set this number of AGVs in a specified range see figure below:
Now I want for every parameter the ExportData function to run, and put it in new rows for every AGV value:
AGV=13 ExcelRow=1 ExportData()
AGV=14 ExcelRow=2 ExportData()
....
So I tried to do this by putting the variable NrOfExperiment in the ParametersVariation agent and let it do +1 after every run see the next figure:
But somehow he only export the data for the last run instead of all the runs? How can I fix this problem? I already tried to put it in after iteration by java actions but this would not work.
Thanks!
Easiest option is to just write all model results into a dbase table at the end, with an extra iteration and replication column (fill with getExperiment().getCurrentIteration/Replication()).
Write to that at the end of each model (on destroy of Main).
At the end of the experiment, simply setup the dbase to export to an Excel file.
I am creating a capacity dashboard that has a granular aspect with multiple rows on the axis. The purpose is so that the user can see the specific view as the fields get more specific, such as Region to Market to Territory. My main problem is if there is a way for a user on Tableau Server to be able to edit the axis (maybe through a filter) so they could basically scale back the granularity a little bit. I know that in Tableau Desktop, you can just remove the dimensions, but I am hoping there is away to do that as a user in Server. Here are some pictures of my
workbook for examples:
You can see that when Territory is removed, it get less specific and shows all of Canada as a whole, grouped together. I am hoping there is a filter view or some way a user could change this dynamically. I have created a parameter with strings that matches the row dimensions that maybe when selected, will show up to that row, but I am not sure how to link that into the dashboard. Here is a picture of that:
Thank you for any help!
The best way to do this is to create a Parameter with your three Axis choices. It should look like this:
Next, create a calculated field that only references the Parameter like this:
Next, you will create three separate sheets. On each one, add the Axis Filter to the Filters Shelf. One each separate page, select one of the three values in your Parameter. (Tip - if the value doesn't show up you can either change the parameter or type it in manually under "Custom value list".)
What this does is create a filter whereby only ONE of the sheets will show up at any time. Meaning if you want to work on the Market sheet select the Market value in the Parameter.
Finally, to bring it all together, you will put these on a dashboard. Create a new Dashboard and add a Horizontal (or Vertical, it doesn't matter) Object (aka layout container) onto the dashboard. Put all three Sheets inside the layout container. You will see only one will be displayed but all three will have headers. On each sheet, click on the header and check "Hide Title" like this:
Finally, click on any downward triangle and show the parameter:
Now, by changing the parameter your user is selecting from three different sheets... effectively letting them change the Axis.
You can also view this documentation on the Tableau Help site.
I've got a workbook I'm building using public data https://public.tableau.com/profile/alee4645#!/vizhome/JSAClaimantsWardtimeseries/Dashboard1
The basics are working as I want, you see the map, you click on one of the coloured areas and a time series chart appears below the map showing the change over time for that area.
I want to add a couple of comparisons to this data, for example I want the time series chart to show a line for the whole coloured area (Somerset) so people can see how one part of it compares to the overall average.
I have the figures as separate rows in the data but of course when the action filter is triggered they get filtered out along with everything else.
If I edit the action filter in the filter shelf for sheet 2, it has the condition tab and I was hoping I could add [ward code] = "E10000027" (the comparison data I want to use) to the formula box so it would also keep the relevant rows of data, but that stops the chart working altogether.
I could achieve it by getting people to choose an area from a parameter drop down but I'd rather let them click on the map so they don't need to know the name of the area they are interested in.
Can this be done?
Public workbook here. Source is Excel file.
I was able to create ordered bar chart based on (1) Location (2) Product
When I drag Above Three into Color, the graph is incorrect, how to troubleshoot?
Update
I made change such that Calculation computers based on Product, Above Three for each Location, at level Product.
However, Morton's still shows error.
The order in Mortons should descend, based on number of records, i.e.
Dark Chocolate
Beer
Toffee
Coffee
Fries
Rest of the Locations are correct, but only Mortons gives out-of-order products
Update2
Calculated Field Calculation3 = Index()
And I filter Calculation3 for 1 to 3, to display top 3 products
If I remove Calculation3 from filter, it gives correct order but it give ALL products, not the top three popular products (per Location).
I updated workbook to illustrate this. Please advise.
I don't know the purpose of the Index() field but that is creating your issue. Remove it from rows and the color appears to work the way you want it.
I hope this is what you are looking for
I have also published the file at the below address. You can take a view on that.
Tableau Wokbook
I achieved it by the following methods.
I changed the Calculation 3 field from Index() to RANK(SUM(NUMBER OF RECORDS)).
The calculation 3 was kept in between Location and period then edited the table calculation of calculation 3 by keeping the Addressing of the edit table calculation, having only the location and product as shown below and then Set the restarting every to Product.
You can check the workbook for more information
Problem:
I have composite JRXML report. Composite report contains many charts. Each chart is assigned to some dataset. I need to pass the variables/parameters values back to main report from datasets?
Tried:
I tried scriptlets, customizers but they are all scoped to the dataset to which they are assigned and cannot see or change the parameters of the main report.
Global scriptlets do not have knowledge about dataset parameters(to be precise they do not know their values and they can't assign their values, they only can find out their description and names via usage of JASPER_REPORT parameter which has mainly lookup functionallity).
This poses a fundamental problem for me as I can't aggregate values in one place as I can't extract them from each individual dataset.
Context problem:
The reason I need to do this because Jasper reports design is flawed for one fundamental requirement: "consistent colours" across all the charts in the composite report. So if you have "China" in Pie Chart and it has colour GREEN and you also have Bar Chart having different query but returning some values which exist in Pie Chart - you'd want the China to have GREEN colour in Bar Chart too.
Approach to context problem:
For this task you need to exctract all the field values from each dataset and save them in main report parameter. You then have to assign each value to some color value and check aggregate main report parameter inside customizers whether current value has a color assigned. This is at least my plan. For this task I need to be able to get back data from datasets generated by their local queries. But I am limited by the scope of datasets as they work only on input data not output data.