Hello!
In Excel I have 2 columns C and D with formulas in there for a specific purpose.
As an Example I have here cells C12 and D12 in these 2 columns to show he formulas.
C12 = 0.001855 * B12/E12 + 0.998145 * (C11+D11)
D12 = 0.981119 * (C12-C11) + 0.018881 * D11
Let's say the C-column variable is "Running Base" and the D-column variable is the "Growth" and the rows are months. And say I want to copy these formula's to a Tableau worksheet with months in the rows.
You see that C12 is using both it's own previous value C11 (the lag -1 of C) and the lag -1 of D (D11). I can find C11 in the formula in TABLEAU using the PREVIOUS_VALUE function and the previous value of D with the LOOKUP([D],-1) function (the B12 and E12 are not important for the discussion).
Then D12 is also using it's own previous value D11 and both C12 and its previous value C11. Of course we can do similar TABLEAU exercises here, but you already feel a CIRCULAR REFERENCE error coming up ;-).
So, there is no actual CIRCULAR REFERENCE and it's working in Excel. But I do understand why TABLEAU is giving one and I am sure there must be a work-round to this.
Can anybody help please???
Thx very much in advance!!
Herman Mentink
One way to solve this is to drop the calculation in Details part of the Marks and then reference the rows of that field in calculation which doesn't create a circular reference else you are correct tableau will create a circular reference error as behaviour is different from Excel.
Edit----------------------------------------------------------------
Not just a tool tip infact you can use those in calculated fields aswell, Few months back I have implemented same in my report.
A calculation creates 4 rows in my report and I need to do (1st row+4th row) in the same column, so I dropped the calculation in Detail on the Marks and referred same another calculated field. Just check the below example code:
LOOKUP(ATTR([Values]),FIRST()+4) + LOOKUP(ATTR([Values]),FIRST()+1)
Values is the calculated field now above caluction is referring to Values and picking rows 2 and 5 which I can't use directly on the Values column if I drop Values on Text in Marks
In the above image values in detail is original calcualtion and the one I used in text is the referring to values and displaying.
Related
i'm totally new to Tableau but that is what I could potentially use at the workplace, so asking this question to decide if its worth it.
I've a monthly values dataset and I'd like the tool (Tableau) to generate a report to point out anomalies - the ones i have in mind right now are:
1) same data value for x months in a row
2) data value is 0
3) 5 parameters been reported last 3 months and all of sudden only 4 are reported
Is this possible in Tableau?
You can certainly do this. The below is a general example for doing anomaly detection (one standard deviation outside of mean) but you can modify the calc to fit your criteria. If you place your date field in the column position and your metric, lets say Sales, in the row position you can then create this calculated field to label the anomalies.
IF SUM([Sales]) < (WINDOW_AVG(SUM([Sales])) – WINDOW_STDEV(SUM([Sales]))) THEN “Bad
Anomaly”
ELSEIF SUM([Sales]) > (WINDOW_AVG(SUM([Sales])) + WINDOW_STDEV(SUM([Sales]))) THEN
“Good Anomaly”
ELSE “Expected”
END
You can then place the new field on your color mark to highlight each of the results.
I have several products. Each product has four different dimensions, and they're each dependent on one another. Meaning, if I know one, I know the rest of them.
Each product is different, so the way that they depend on each other is different. But the fact of the matter doesn't change-if i know one value of any dimension - i know the rest.
I'd like to be able to just type in a value into the cell and have excel automatically populate the rest for me.
It's too tedious with VBA and i'd like it to be automatic upon entry, and not have to have someone click a button. Just when you type it in.
Thank you
What you want is impossible without VBA. I offer you a simple method instead:
There's an infinite amount of ways to do that. I want some SE points. So, I will just post the first method that comes to mind.
Have two rows:
Input: [Height] [Width] [Length]
Result: [Height] [Width] [Length]
(the above will have the following shape:)
A1 B1 C1 D1
A2 B2 C2 D2
You don't touch the result row. You input into the blank input rows and then the result rows check for the input and calculate accordingly.
In the result row, you will use "nested if", NOT(ISBLANK(A1)) and your own calculation method. Here's an example of nested if: =IF(NOT(ISBLANK(A1)),A1*2,IF(NOT(ISBLANK(B1)),B1*3,IF(NOT(ISBLANK(C1)),C1*4, IF(NOT(ISBLANK(D1)),D1*5))))
Each cell in the result row will require a different calculation formula.
I suggest you open a brand new excel worksheet and paste the above formula into cell A2. Then, type a number into either A1, B1, C1 or D1 and notice what happens in cell A2.
Also, please note the above formula has not been "fixed". If you drag the formula, excel will try to adjust it and things can go bad.
How do I get a crosstab in Crystal Reports 2013 to exclude null values from a crosstab average?
For example
Procedure Name : OCT RETINA
Procedure Count : 8
Procedures with Completion Times Populated : 6
Summary of all 6 Completion Times : 101
I was expecting the average of the Completion Times to be calculated as 101/6. Instead, Crystal Reports is calculating the average as 101/8. It needs to be calculated as 101/6 (without counting null values in the denominator).
Adding another group is not an option because of the very specific way the values are sorted in the detail (hence a crosstab in a footer). The names of the procedures are dynamic so keeping a running total of each procedure's average completion time is not an option either.
Thanks in advance!!!!
One solution would be instead of taking the field create a formula use that in cross tab.
Create a formula #count
if << procedure field>>=<<your value>>
then 1
else 0
Now place the formula and take sum instead of count
Thanks for everyone's feedback! The answer is to use Weighted Average instead of just a plain old Average.
All I had to do was
a. Create a formula field called IncludeProcInDenominator and set the value to
if {Command.ProcTime} > 0 then 1
b. Right click on the Average Proc Time calculation in the crosstab and select Edit Summary
c. When the Edit Summary dialog box appears, in the Calculate This Summary drop down, select Weighted average with
d. In the dropdown box underneath that, select #IncludeProcInDenominator
In effect, the only values that are averaged are the ones where #IncludeProcInDenominator = 1
Thanks for everyone's help!
I'm facing problem in getting the max % and min % from a table containing % difference values.
Year-----A----------B---------C---------D---------Max %----Max Type----Min %----Min Type
2012
2013---4.30%---4.42%---4.34%---4.38%----4.42%---------B-----------4.30%---------A
The table above shows the % difference in sales from previous year. Thus 2012 shows no % (because there's no 2011). I used table calculation to compute the % difference, i.e. "Percent Difference From", compute using "Table (Down)" and "Previous".
The last four columns are what I'm having trouble doing. I want to get the max % and min % and also the corresponding types. I'm not trying to add the four columns to the existing table, but to get the correct results, as my ultimate goal is to display that results on the dashboard, i.e. on my dashboard, I want to display the highest % and its corresponding type; similarly the lowest % and its corresponding type. For example: on my dashboard, I want to display:
Highest % and type: 4.42% B
Lowest % and type: 4.30% A
So, I need to have the correct formulas to get the max % and min % and their types. These are what I did:
I tried to use WINDOW_MAX and WINDOW_MIN to display the max % and min % on the table but got funky wrong results.
1) I first get the formula in calculating the % difference from the "Customize" button from "Edit Table Calculation" window of SUM([Sales]): (ZN(SUM([Sales])) - LOOKUP(ZN(SUM([Sales])), -1)) / ABS(LOOKUP(ZN(SUM([Sales])), -1))
Then I created a calculated field of the above formula. I named the calculated field "Percent-Diff".
2) I created another calculated filed (named "Max % Difference") using the formula: WINDOW_MAX([Percent-Diff]). But it shows strange results. See image below. I don't know why it gives me 2.78% and 2.91% for 2012 and 2013 respectively. It should be 0% and 4.42% for 2012 and 2013 respectively. Something is not correct.
If it is just SUM([Sales]) instead of % difference, then I get the correct result of showing the max sales using the formula WINDOW_MAX(SUM([Sales])).
3) Also I don't know how to get the corresponding type. I tried using the formula: IF [Max % Difference] = [Percent-Diff] THEN ATTR([Product Type]). But it returns:
NULL
B
I'm not sure if the formula is correct. It looks correct on the result (i.e. "B" is correct), except that it also shows a NULL value which I don't know why. I think it's because I didn't include the ELSE part in my IF formula? But why the NULL value is shown as the first value? I want the formula to return just one value, "B". So, how to only just show "B"?
I've posted twice the problem in tableau forum, but as of now, nobody has answered my problem. I believe that my formulas are incorrect. So, if anyone here can correct the formulas to get the max % and min % from % difference values and also to get the corresponding type, then it'd be very much appreciated. Thanks a million!
It's hard to tell not knowing how your database looks like (as you didn't explicitly presented it, but I can try to infer based on the clues you left on your post). But I could reproduce something like you said using the Sample - Coffee Chain Database, and it worked out well, calculated yoy sales increase by product and then window_max of that.
What you're probably missing is the partitioning. I suggest avoiding using Table or Pane to create the partitions in more complex situations (as it will work only in that specific arrangement of fields), but rather use the dimensions to partition it.
So, your [Percent-Diff] field should be compute using [Date], and your [Max % Difference] should be compute using [Product Type]. IMPORTANT, for [Max % Difference], when you go to Edit Table Calculation, you'll have to choose the Compute using for [Percent-Diff] as well (you can choose on the top of the window)
Your formula to find which type is the max (or min) is also correct (and should only respect the partitions). Nevertheless, it is very hard to have the exact output you're expecting.
What I would do is to create 2 spreadsheets (and later combine them in a dashboard).
The 1st would be what you already got (Each product [Percent-Diff]
The second one I would change your formula (3) to just [Max % Difference] = [Percent-Diff], and use it as filter (filtering only true). I would drag both Date and Product to the sheet (you choose if you want it on columns, rows, or just detail) so I can use them to partition the table. And drag [Max % Difference] to be visualized.
That way you'll only see the product that is the max, and how much is that max.
Hope it helps
I'm a complete Matlab newbie, so please bear with me :) I'm using my friend's vague instructions, so I don't if they are correct.
I have variable named m12 (imported form an .xls file), which is an 61x3 array. No labels.
The first column contains leverages, the second standardised residuals for the training (first 46 rows) and validation (remaining 15 rows) sets of a PLS model.
I want to group those first two columns, so that the training set is represented by blue 'X', and validation set by red 'O', so I put 46 rows of '1's and next 15 rows '2's in the third column.
My friend told me to simply type:
group(:,3)
gscatter(m12(:,1), m12(:,2), group,
'br', 'xo')
but when I type
group(:,3)
I get an "??? Undefined variable group." error.
Can anyone help me?
Just write
group = m12(:,3);
instead of your first line.
This way, you're defining a vector group that contains all the entries of the third column of m12, i.e. your grouping variable.