I am emitting metrics in my service.
How do I create a chart that accumulates all the values for the key for a given day, for a week.
For example I emit {keyA: 4} {keyA: 2} in a single day.
The bar for that day should show that keyA had a daily count of 6.
I tried to do it but the results don't seem accurate.
I attached a screen shot of what it should look like (Each bar is 24 hours)
What should the settings be for this?
.
Related
The dashboard in the linked workbook shows a table with sales split by year on the top. Below, there's a table with the rolling average of the last 4 weeks, including the current. It's set to show NULL if there are not enough data points. I'd like for it to compute the first January 2018 value based on the current week and 3 full weeks from the end of 2017. Carrying that concept forward, all NULLs from 2018 onward will be eliminated. The NULLs for the first 5 weeks of 2017 will be the only NULL values. The average should always be computed on a full 4 weeks (28 days) even when week 53 doesn't contain 7 days.
How can I write a calculation to achieve what's described above?
I've tried putting the WINDOW_AVG function inside a LOD, but that's not allowed. Furthermore, I've also tried using FIXED and even FIXED inside WINDOW_AVG.
Here's one of my attempts:
{FIXED [Week_int]:
WINDOW_AVG(SUM([Sales]), -4, 0)
}
It returns this error: "Error: Level of detail expressions cannot contain table calculations or the ATTR function"
Here's the data structure. It includes one value of Sales per day.
Basically I created a dummy data in Excel by creating dates (from 1-1-2017 to 2-2-2021) and filling some random values (unif dist *5000) against these.
I added Week[date] to columns and year[date] to rows as in your screenshot. I added sum(value) on the text marks card.
Thereafter, I added table calculation --> Moving average --> edited it for previous 4 values , next 0 values, (check current value if you want to include current record), then check Null if there are not enough values. (your requirement). --> click compute using -Specific Dimensions change the order of fields below - drag Year above than week (table across then down will also create the same view)
You should be able to get a view as desired.
Regarding your query on number of days in the week, Tableau caters it automatically if you have chosen it datepart.
Edit I verified this in Excel, the method is correctly working.
See, the average of first 28 values in Excel
and the view built in tableau:
Here's the corrected dashboard hosted on Tableau Public.
I am making a dashboard with clicks on a daily level and a month level on a certain campaign.
If I have say 1 customer clicking on 2 days then at a daily level that customer is counted twice. However, when I look at the aggregate monthly level this person will be counted once.
My SQL code that I am pulling into tableau is at a daily level. How do I get a monthly level view in the dashboard? When I am creating a parameter with month and day..on selecting month it is just adding the day level numbers to give me the month.
Any advice?
Sounds like a count distinct thing. To get around this the COUNTD would need to happen in Tableau. That would mean you need the Contact ID (or whatever it is you want to count) within the data source. Obviously that would mean your data source is much bigger but is the only way to get an accurate unique count over a custom time period.
Another alternative is to restrict the available time periods for the user and pre-aggregate for those time periods.
I am trying to create a visualization of product build times over the year.
what I want to see, at the lowest level of the hierarchy, is for each job, the main/max/avg/mean/std dev as wavy lines over time.
my database has job name, date/time, status, and duration
the job name has a structure to it, so I would like to take the 1st 3 chars and build a hierarchy. the second set of 3 chars defines the 'product group'
so I would like to see these 5 lines for product group, drill in to product team, drill in to job, across the 365 days of the rolling timescale we collect data for (1 year).
I can get, for each 'job', a pane that shows max, or min, or avg, as lines, but I cannot get them together in the same chart..
start date as column, job name, max/avg/min/std as row elements
for the hierarchy, it looks like I have to place that data in the data source to be able to use it. I cannot find a way to define a hierarchy based on part of existing data
I want to set the default range on a date filter to show me the last 10 days - so basically looking at the lastDate (max date) in the data and default filtering only on the last 10 days (maxDate - 10)
How it looks now:
I still would want to the see the entire range bar on the dashboard and give the user the ability to modify the selected range if he wants to. The maxDate changes after every data refresh so it has to be some sort of a condition that is applied to the filter.
How I want it to look (by default after every refresh of data - new dates coming in):
Any suggestions on how this can be done? I know I can use the relative date and show the data for last 10 days but that would modify the filter and create a drop down which I don't want.
Any suggestions are welcome!
One simple approach that does most of what you want is the following:
Create an integer valued parameter with a range from 1 to some max
you choose, say 100. Call it say num_days.
Show the parameter control on your dashboard as a slider, and give
it a nice title like "Number of days to display"
Create a boolean calculated field called Within_Day_Range defined as:
datediff('minute', [My_Date_Field], now()) < [num_days] * 24 * 60
Put Within_Day_Range on the filter shelf and select the value true.
This lets the user easily select how many days in the past to include, and works to the granularity of minutes (i.e. the last two days really means the last 48 hours, not starting at midnight yesterday). Adjust the calculated field if you want different behavior.
The main drawback of this approach as described so far is that it doesn't display the earliest date possible in the database because that is filtered out. Quick filters do an initial query to get the bounds, which has a performance cost -- so using the approach described here can avoid that query and thus load faster.
If you really need that information on your dashboard, you could create a different worksheet to get just the min([My_Date_Field]) and display that near your parameter control.
I have a Crystal Report where I am using the 'gauge' chart to display On Time delivery for a business. The Gauge requires an "On Change Of", but I ahve two seperate values I want to display on the same gauge, one for overall and one for the last week. I can do this, by creating a null formula and setting the OnChange of to that, but then the needles are the same color. Any thoughts on how I can get one needle for overall and one needle for last week?
My Table is just a list of Manufacutring Orders with Due Dates and Completion Dates. I use a formula to decide if the order was on time, if it was I print the Order Number. Then I use a summary field with a distinct count of order numbers to determinie the total number on time orders. This divide by the total distinct order counts and then I get a percentage for OTD...
Okay this one deserves some more explanation. For each detail, which was essentially a list of sales orders, I had a date requested and a date completed. From those two fields I calculated a third field that returned either "On Time", "Late", or "3 Day Window" and I wanted to display a gauge chart of all records On Time.... Our OTD %
In addition to this I wanted to display the weekly numbers versus the numbers prior to that week. To do this I created a fourth column that returned either "This Week" or "Historical". I could now do a Multiple gauge type chart for each record with an on change of OTD State and Weeklyorhistorical. This produces side by side gauges labeled correctly with historical and weekly OTD.