SQL Report builder: split data between primary and secondary axis - reportbuilder

I have a table which contains Date (DateTime), Value (integer), and TagID (integer).
The TagID refers to the ID of some transmitters that send me data (the current date and time and a numeric value retrieved from a sensor) every n seconds; this data is stored in the table I described before.
I need to create a chart to compare the data of two of these transmitters, but I encountered a problem. The numeric values of one transmitter is usually under 100, while the other is well over 100000, so if I just put them together on the same scale, the first one is unreadable.
Can I scale the data of the second transmitter using the secondary axis? How?

You can select then right click on the horizontal axis on your chart, open Properties and on the Axis Options tab there are two things that can work for you:
Axis range and interval: if you have a set minimum, maximum and interval values
Under scale options, you can turn on logarithmic scale if that's more fitting

Related

How to plot daily increment data from a sparse data set with interpolation in Grafana?

How can I plot time-grouped increment data in a bar graph in Grafana, but with a sparse data source that needs interpolation BEFORE calculating the increment?
My data source is an InfluxDB with a sparse time series of accumulated values (think: gas meter readings). The data points are usually a few days apart.
My goal is to create a bar graph with value increase per day. For the missing values, linear interpolation will do just fine.
I've come up with
SELECT spread("value") FROM "gas" WHERE $timeFilter GROUP BY time(1d) fill(linear)
but this won't work as the fill(linear) command is executed AFTER the spread(value) command. If I use time periods much greater than my granularity of input data (e.g. time(14d)), it shows proper bars, but once I use smaller periods, the bars collapse to 0.
How can I apply the interpolation BEFORE the difference operation?
Described situation by you is caused by fact that fill() fills data only if you do not have anything in your group by time() period in your query. If you get spread=0 then you probably have only one value in this period, so no fill() is used.
What I can suggest to you is to use subquery with lower group period time to prepare interpolation of your original signal. This is an example:
SELECT spread("interpolated_value") FROM (
SELECT first("value") as "interpolated_value" from "gas"
WHERE $timeFilter
GROUP BY time(10s) fill(linear)
)
GROUP BY time(1d) fill(none)
Subquery will prepare value for each 10s period (I recommend to set this value possibly as high as you can accept). If in 10s periods are values, it will pick the first one, if there is no value in this period, it will do an interpolation.
In main query there is an usage from prepared interpolated set of values to calculate spread.
All above only describes how you can get interpolated data within shorted periods. I strongly recommend to think about usability of this data. Calculating spread from lineary interpolated data may have questionable reliability.

Displaying change in moving average on map

I am trying to show the change in moving average by county on a map.
Currently, I have the calculated field for this:
IF ISNULL(LOOKUP(SUM([Covid Count]),-14)) THEN NULL ELSE
WINDOW_AVG(SUM([Covid Count]), -7, 0)-WINDOW_AVG(SUM([Covid Count]), -14, -7)
END
This works in creating a line graph where I filter the dates to only include 15 consecutive dates. This results in one point with the correct change in average.
I would like this to number to be plotted on a map but it says there are just null values.
The formula is only one part of defining a table calculation (a class of calculations performed client side tableau taking the aggregate query results returned from the data source)
Equally critical are the dimensions in play on the view to determine the level of detail of the query, and the instructions you provide to tell Tableau how to slice up or layout the query results before applying the table calc formula. This critical step is known as setting the “partitioning and addressing” for the table calc, sometimes also as setting the “compute using”. Read about it in the online help for table calcs. You can experiment with using the Edit Table Calc dialog by clicking on the corresponding pill.
In short, you probably have to a dimension, such as your Date field to some shelf - likely the detail shelf, and the set the partitioning and addressing, probably to partition by county and address by state.
If you have more than a couple of weeks of data, then you’ll get multiple marks per county. You may need to decide how to handle that on your map.

y axis limit - appears to alter the data that is analysed

I have a bunch of data where the hours taken to process an item ranges from 3-3000 hours. most of the data is <1000 hours
I am creating a boxplot of that data. I have an large number of outliers within the data that I don't need to display, but I do need to analyse.
I have tried to use both 'scale_y_continuous(limits=c(0,1000))' and 'ylim(0,1000)' that appears to change the data that is used to create the boxplot, I altered the limits to '20' to test this theory and I get a complete plot, which can only be because the method i'm using to limit the axis also limits the range of data analysed.
I'd like to limit the y axis but not limit the range of data that is used in the analysis, what function do I use to accomplish that?
many thanks
it appears that it's 'coord_cartesian(ylim = c(nnn,nnn))+' that I needed to use.

Custom x-axis values in Power BI

I want to plot a graph over a year+weeknumber on the x axis.
Each data-point contains this specific value; for example week 7 of 2016 is expressed as 201607 etc. and called YearWeek
I created a date table in which I calculate all possible YearWeek value in a certain date-range. Then I created a YearWeek table extracting all distinct YearWeeks.
This I connected to the Fact-Table. What I want to chart is exactly according to this matrix:
Note that I explicitly selected to show items with no data to obtain the full time line. It continues down to 201852 but you get the picture.
When I attempt to plot this, it results in this:
It's hopefully clear that the straight lines running from 201652 to 201700 and 201752 to 201800 are the problem.
There's three things to note:
I explicitly need to keep the x-axis continuous, no gaps in the plots or x-axis values skipping several weeks for lack of data.
PowerBI somehow does not want to accept that these values count to 52 and then continue in the next year and decides to make the values strictly numerical despite these values not existing in the YearWeek dimension table.
If I change the values to text, PowerBI recognises that these are distinct categories, but it won't provide a continuous axis, just the values for which there is data.
I've tried to connect the YearWeek Dim table to an actual Date Dim table hoping that time intelligence would kick in; the problem is that both for the Fact Table and the Date Dimension table the YearWeek Dim is the unique value which won't work given the filter-direction. If I start messing with many to many relationships or bi-directional filtering I'm out of my depth.
How to fix this?

Tableau: How to divide two table calculations?

I have these calculated measures which I use within a tool tip as table calculations
[alert_count_by_action] = total([distinct_alerts]) compute using day
[alert_count_all] = total(distinct alerts]) compute using table across
When I mouse over an action name colored widget type I can see that the [alert_count_by_action] and [alert_count_all] are producing the correct values. What I would like to do is to compute a percent by dividing [alert_count_by_action] / [alert_count_all] which I will call [alerts_by_action_percent_overall]. This is not working at all despite trying every combination available on the table calculation options within the Marks card.
What am I doing wrong?
Without the attached workbook, I can only suggest to check the partitioning of your % calculation. Because both components of the fraction are themselves table calculations, they can be partitioned separately (i.e. "compute using" options).
There should be a combo-box in the 'Edit table calculation' dialog that selects which component is being configured.
Maybe you have configured one part, but not other?