How to get three measures in a single chart? - tableau-api

I want three measures in a single chart.
Time spent by an employee in the office. (Available hours)
Time spent by an employee on productive tools. (Productive Hours)
Percentage of time spent productively. (PH : AH %)
I have used dual axis for 1 and 2 as 2 will always be less than 1.
I want it to look something like this
The problem is when I use blended axis it does not show the "tools hours" as a part of "available hours". So for example if an employee was available for 5 hours out of which he worked on productive tools for 3 hours the blended axis will show total available hours to be 8.

Your available hours is aways greater than your tools hours?
So, you should use a calculated Field where you show the tools hours and the "available hours" - tool hours.
It can also be solver by transforming your data source input.
PS: Yes, you can make formulas (calculated fields) across joins and blendings.

Related

Can I calculate a moving sum on a field in InfluxDB?

I'm trying to understand if it's possible to calculate a 1 month sum of revenue data in one of my measurements. For each day, I would like the sum of the previous 30 days.
Is this possible in InfluxDB or through Grafana's query interface?
A moving average is a moving sum, divided by the number of samples. So if you want a moving sum of the past 30 values:
select 30*moving_average(field_name, 30) from measurement
Edited to add:
As Peter Halicky points out in the comments, this is is not the past 30 days. It's the past 30 data points.
If you will always have data for every single day, it's not an issue.
If you're missing a day's data, you'll still get a 30-sample average, but it'll stretch over 31 days instead of 30.
If you don't actually care about the calendar, but want to know the past 30 days of activity, this is not a problem.
If it is a problem, there are a few work-arounds. One that's probably trickier than it sounds: ensure that there is always an entry for each day.
A more robust way is to have the reporting app do this in two steps. Something like this (haven't worked out all the details, but you get the idea):
find the number of data points in the past 30 days, using a query like select count(field_name) from measurement where time > now() - 30d.
Use this number (call it n) to form the query: select n*moving_average(field_name, n) from measurement where time > now - 30d.
Yes, definitely it's possible.
Just set this part of your query like this:
SELECT sum("value") FROM "YOUR_TAG_NAME"
WHERE $timeFilter GROUP BY time(30d) fill(null)
Just make sure that your dashboard time included Last 30 days (at least).

Tableau: graphically show compounded leadtimes

I have a chart that shows the number of departures for a given 15 minute interval as seen here.
I need to compound these counts backwards for one hour. For example, the 3 departures shown at 11:00 need to also be represented at the 10:00, 10:15, 10:30, and 10:45 columns. When completed, the 10:00 would have a total of 6 departures (10:15 -> 6, 10:30 ->5, 10:45 -> 4, 11:00 -> 4).
I have done this via VBA in excell, but am now needing to replicate the chart in Tableau and have been beating my head in for about two weeks now. I'd love to hear any and all suggestions.
You can use a Cartesian join against a large enough date range of your choosing to in effect resample your data and add the additional time intervals you desire.
For example, if you have a month's worth of data (min date -> max date = 30 days), then you have (30 * 24 * 4) 2880 15 minute intervals.
Create all those intervals in a separate data sheet
Add a bogus column with value of link for all rows
Create the same bogus in your actual data source
Join the two sheets together on the link column
Create a calculated field that is something along the following:
[Interval] <= [Flight Time] AND [Interval] >= DATEADD('hour',-1,[Flight Time])
This calculated field will evaluate to TRUE when the interval time is within one hour before the flight time. You can then drag this field onto your filter shelf and select TRUE value only. Effectively your [Interval] field becomes your new date field.
I would recommend adding that filter to the context and applying across the entire datasource. Before you add this filter you'll have 2880 times the about of data so be sure to do a live view first. Be careful with extracts using Cartesian joins as you could potentially be extracting more than you bargained for.
See the following links for different techniques on how to do this and re-sampling dates in general in tableau.
https://community.tableau.com/thread/151387
Depending on the size of your data (and if a live view is not necessary) it is often times easier and more efficient to do this type of pre-processing outside of tableau in SQL or something like python's pandas library.
Here is another solution provided from the Tableau Cumunity Forum. I have not tried tyvich's solution yet, but I know this one got me where I needed. Please follow the link to see the solution using moving table calculations.
https://community.tableau.com/thread/251154

Find and Rank Time Series MATLAB

I know there must be a simple way that I can learn to do this but I cannot imagine how to start. I am tasked with finding a top 10 matching daily wind power time series in a 30-day plus/minus window from the first day in the time series (Jan 1st) matching a single daily wind power time series and it is out of my level of experience in MATLAB. I have successfully done this matching a single time series of the current year with the exact calendar days from previous years, but I need a more robust searching method to find the best correlated time series in a +/- window of time. For example, I'm comparing a 120 day time series (without leap years) with 25 previous years during the same 120-day period (Jan-Apr). The end result will show me the top 10 time series with the years and Julian day or cumulative day listed and a correlation or RMSE value associated with it. My data looks like this arranged in a 365 (days) X 25 (years) array and I thank you very much for your help!
1182573 470528 1638232 2105034 1070466 478257 1096999
879997 715531 1111498 1004556 1894202 1372178 1707984
636173 937769 2119436 742710 1625931 1275567 1228515
967360 1103082 2218855 1643898 1822868 554769 1325642

Tableau: Four week moving average, first four weeks

Setting
As I'm sure many of you do in your vizs, I use date parameters for my data. This is great for creating trend analyses and all types of time series representations. Currently I'm using a line graph to show our sales hit rate history.
Picture
Question
The problem I'm running into is in creating a four week moving average. As you can see the four week moving average doesn't become just that until four weeks in! This creates quite the problem for me. What methods will enable the average at t=0 to show the average for the preceding four weeks?
Formula Used
This is my formula for creating the four week moving average:
WINDOW_AVG([Hit Ratio],-27,0)
Remove your date filter and try:
IIF(ATTR([DATE_FIELD])<T=0,NULL,WINDOW_AVG([Hit Ratio],-27,0))

Crystal Reports 9 Graphs/Chart

I have a cross tab with data showing clients per hour per day. So the rows are days of the week and the columns are the hours of the day, with the values being the number of clients.
Now to the main point :), I want to produce a graph for each day of the week, that shows the number of clients per hour for that day. So the report would have 8 graphs in total, one for each day and then an "all days" graph. See Picture:
Click, as I can't include pictures yet
Any idea how to do this, as I can't find a filter or anything, and the only graph I can get is all on one, with multiple bar lines for the days, in each hour block.
Ok, just figured this out :)
I have created a formula for each week day, that contains the following:
if {Command.day} = "Monday"
then {Command.kpi1}
else 0
Then in the chart expert, use this formula field for the values...so simple but overlooked :#