getting incorrect running sum variance calculation in tableau - tableau-api

I have a calculation
RUNNING_SUM(SUM([CurrMonth])/RUNNING_SUM(SUM([PrevMonth])))/100
it should give me the %
$1616409.73 / $986568.61 163.84%
but it's actually giving me 125.84%
if I change the date posted from actual day to business day it gives me 511.12%
both of these are not right.. does anyone know a better calculation I can write to give me the number that I need?
Thanks in advance

I fixed it...by moving one of the closing parentheses from the previous month to after the current month. RUNNING_SUM(SUM([CurrMonth]))/RUNNING_SUM(SUM([PrevMonth]))

Related

How is it possible to calculate value for the same day last week in tableau for every day?

I would like to calculate values for yesterday for every date in a table.
Firstly I have simply calculated the number of orders for each date using COUNTD function.
But afterwards I encountered some problems trying to calculate values for "yesterdays".
Please refer to the image
example
For example for 12th of April I would like to obtain the value for 11th of April.
On the internet there are a lot of examples using today() or max() or table functions but they do not give the required result because a would like to filter for example 12th April but still see the value for 11 April.
Could you please help, how is it possible to do this?

Tableau Summing up aggregated data with FIXED

Data granularity is per customer, per invoice date, per product type.
Generally the idea is simple:
We have a moving average calculation of the volume per week. MA based on last 12 weeks (MA Volume):
window_sum(sum([Volume]),-11,0)/window_count(count([Volume]), -11,0)
We need to see the deviation of the current week vs the MA for that week (Vol DIFF):
SUM([Volume])-[MA Calc]
We need to sum up the deviations for a fixed period of time (Year/Month)
Basically this should show us whether on average, for a given period of time, we deviate positively or negatively vs the base.
enter image description here
Unfortunately I get errors like:
"Argument to SUM (an aggregate function) is already an aggregation, and cannot be further aggregated."
Or
"Level of detail expressions cannot contain table calculations or the ATTR function"
Any ideas how I can go around this one?
Managed to solve this one. Needed to add months to the view and then just WINDOW_SUM(Vol_DIFF).
Simple as that!

Calculating Missing Weeks in Tableau

I am trying to calculate the missing weeks in the data. Below image shows how is my existing data.
The below image shows what is expected results:I am trying to calculate "Calculated Calendar Week" and "Calculated week Diff"
Any help in achieving the desired results is greatly appreciated!!
Thanks,
Ganesh
I fixed this by creating another data set with all the missing weeks and did a right join!

Tableau MTTD calculation only shows one result

I'm calculating how long it takes to detect an issue in Tableau.
I have the following calculated field to work out mean time to detection:
DATEDIFF('hour',[DATE Reported], [DATE Responded])
When I use the meantimetodetect calculated field it only shows me one result and the rest 0s.
The one result shown is correct there were 3 days apart from when it was reported to the response date. The rest of the results are reported and responded in the same day so I dont know if that has anything to do with it?
Does anyone know why it is displaying like this perhaps there is a better way to calculate it?
Thanks.

Forecasting with gaps in time series

Hi I'm trying to use the built in forecasting function in tableau and I think it's greyed out because my timeseries values have gaps. Basically there are hours during the day when nothing happened in my data, so nothing got recorded. I'm trying to build a forecast but my data jumps to the 2nd hour, then has results for each hour up to the 6, and jumps to the 9th. I know in ssrs I would try left joining the sql query I'm using as a datasource to a derived field with all 24 hours. I was hoping there was a slicker trick in tableau. All help is greatly appreciated.
Without having your worksheet, I'm not sure if it could be helpful, but have you already tried this quick fix suggested by Tableau?
Basically you should use discrete measures and using the "Fill missing values with zeroes" option.