Tableau: hide table calculation for only one column - hide

I'm working on a visualization in Tableau, regarding numbers for actual figures, budgets, and estimates. For budget and estimate, I also want to show the percentage of difference compared to the actual. I have these numbers for several categories.
I recreated an example as below.
What I now want is: Hide the percentage calculation ONLY for the actuals column.
I tried several things. but it always ends in multiple columns being deleted. How can I do this?
(Percentages are calculated across table and based on "actual" scenario).
Edit 1: As in one of the answers, creating seperate calculated fields for each value is an option. But in my problem, I will have a lot of measures where I want to disply it this way. So creating 5 calculated fields for every measure is really a last option.
Also: I now solve it using 2 different sheets on the dashboard. One sheet with actual numbers, and one sheet with percentages (hiding the actual column). But then the line up is not so nice, and also when the sorting of the dimension changes, it is tricky. I have also options to drill down the hierarchy of a dimension, and with two sheets, one of the two will of course not adapt then.

Currently you are using F1 for rows and F2 for columns and measures that will split to as many values as F2 has (Currently their are 3 columns).
Solution that I can think of in this particular case is to remove F2 from columns part and create 5 formulas for the measures.
Actual Sum // Since we don't want Acutal (%diff) we won't create that formula
Budget sum
Budget (%Diff)
Estimate Sum
Estimate (%Diff)
Now formula will be like
If F2 = "Actual" //Same goes for Budget and Estimate
Then f3
End
Take one more sheet now add the quick table calculation for difference for Budget and Estimate and add those to Formula fields.
Now place all 5 formulas in columns part, So you have your measures.
To add the column headings you can use dashboard, Add the sheet to dashboard and manually add texts to the measures that will look like the one you have attached in screen shot.
I have implemented a sample using Sample super store and attaching the screenshot for the same.

Related

Insert subtotal for Excel spreadsheets

I have some irregular data (e.g. I have 5 groups of data, each group occupies different amount of rows) and I am wondering if there is a way to use Python to add subtotal to all of my spreadsheets, breaking at each group change.
Since row amount is irregular for each group, I tried inserting empty row at each change and adding a subtotal. However, I am unable to do a sum for each change or a grand total without using hard code (specify on the row number, which changes for every spreadsheet).
Thanks in advance.
Edit: Added code I am working on
for num in range (8, ws.max_row+1):
if ws['E'+str(num)].value == ws['L1'].value:
ws['L'+str(num)]='=SUMIF($A$'+str(ws[num])+':$A$'+str(ws[ws.max_row])+',LEFT(A'+str(ws[num])+',6),$E$'+str(ws[num])+':$E$'+str(ws[ws.max_row])+')'
num+=1
Can you add a column to each list that can help you categorize them? that way you can do a =SUMIF based on the categorized names. here's a code snipit and an image to reference:
=SUMIF(B:B,B15,C:C)
the formula calculates the left table (dogs).
as you can see the totals wont be added if the category is mentioned. also, all three tables are irregular so it will add up regardless of length.

Calculate average of values in a column based on matches of two variables in two other columns

I'm having an issue with some data that I'm working on that has had me stuck for a while.
I'm working on some patient data for a clinical practice that has each patient encounter logged on a separate line with an account ID, date of service, the height and weight measurements for that date, and other variables.
Aside from VLOOKUP and the usual formulae/functions I've got a pretty rudimentary understanding of Excel but I can pick up on things fairly quickly.
In the data I've got each line tied to a patient account ID as well as what quarter the DOS was in. For patients with multiple visits, they will be identifiable by repetitions of the account ID number on other lines.
For some patients, there will also be repetitions in the quarter if the same patient was seen twice in the same quarter. This is where I need help.
I'd simply like to average the value of a variable for each patient in each quarter. I'm not sure if AVERAGEIFS is the right function to use but I need an operation that checks for matches in a line of both account ID and quarter (Q1, Q2, Q3, or Q4) with the other lines in the sheet and comes up with a quarterly average for the variables in question.
What I have
What I need
If I'm understanding your question, you could use AVERAGEIFS to accomplish what you are asking. With excel, a lot of how successful an approach will be is determined by how your data is structured, and if/how often you are planning on updating your work.
It would be easier to give a concrete answer with an example of the data you are looking at.
If your source data is in columns A:D something like:
and you are looking to summarize the weight data in I by account ID and Quarter:
you could use AVERAGEIFS(C:C,A:A,G2,B:B,H2) this would find the cells in column A that match the value in G2, find the cells in column B that match the value in H2, and report the mean value in column C of the matching rows.
An alternative is to use a pivot table, which automates a lot of what you are trying to do. For that approach you would select your data block, and click on Insert>>Insert Pivot Table (at least in my version). That should bring up a wizard. Accepting the defaults will create a new sheet. Then look on the right side of your window, and you should see a list of your column names near the top, and four boxes called Filters, Columns, Rows, and Values. You should be able to drag and drop your columns into these boxes to get summaries of your data. If you add your Account ID and Quarter tabs as columns, and your height and weight as Values, then right click on each of the value columns and select "Value Field Settings" and select Average from the menu that pops up. That should give you something that looks like:
At that point, you can change the formatting to make if fit your needs, or copy data somewhere else.
The AVERAGEIFS approach will automatically update if you add more data, but will only summarize things that match the values you list. If there is an account ID/Quarter pair that isn't in the summary column you won't have any idea it's there. If you are summarizing an ID/Quarter pair that isn't in your data you'll end up with a division by Zero error like in the example.
The Pivot Table option only updates when you manually click refresh (right click and choose refresh pivot table from the menu), but will summarize all the data based on the columns you've selected. It's also a little more robust as you avoid having to type out the formulas and make sure you are pointing to the right column. This option also by default provides nested summaries; you can turn the subtotals and grand totals off if you want.
I used the function:
=SUMPRODUCT(($B$2:$B$13="Customer 1")*($C$2:$C$13="Q1"))
Where Customer 1 could be a user id and Q1 you can change to which quarter you want.
Excel screenshot

Multiple Criteria Filtering - Assigning Values for multiple rows

First off, I am not sure if what I want can be accomplished this way.
Please refer the image attached.
So there are 5 journal entries. 3 of them have a debit & a credit leg, 1 of them has 3 legs & 1 has 4 legs. Now, the 5 entries have a single unique "Voucher Name".
What I exactly want is, if I filter "Cash" from Particulars column, by default in excel, I get the rows 2,4.
But what I want is when I filter "Cash", the entire journal entries with "Voucher code" which contains Cash must appear filtered. That is to say, rows 2,3,4,5 have to get filtered.
how do I do this??
PS: Pivot did not work.
I have data which is of 30000 line items.
SO manual work is not possible.
I have a solution that will remove the data you're not interested in, but I couldn't get the default filtering to work (this will not "compress" the table). Therefore, the data will still be scattered across 30,000 rows. However, it will allow you to perform statistical analysis on the data of interest.
Assuming your original picture from above (copied in case it changes):
Put the Particulars value you would like to filter (i.e. "Cash", "TDS", etc) in G1. Now put the following array formula (ctrl+shift+enter) in G2:
=INDEX($C$2:$C$8,SMALL(IF($B$2:$B$8=$G$1,ROW($B$2:$B$8)-ROW($B$1),""),ROWS(G$2:G2)))
I obviously only used the first 8 rows of your data, so you'll have to expand. Then, put this formula in H2:L2 (referencing A2:E2):
=IF(COUNTIF($G$2:$G$8,$C2)>0,A2,"")
Now, drag H2:L2 down to the bottom of your dataset. When you supply one Particular in G1 the formulas you dragged should only show that in which you're interested. You'd have to expand on this concept for multiple Particulars, but I hope this answer will suffice.

Transpose multiple rows into columns

I've came across this task and I'm stuck big time. I've tried a PivotTable but it didn't give me the desired result. The only thing that works is a manual transpose but the number of records is 5k odd.
What I'm trying to achieve here is to transpose the data from rows for the company into columns so at a later stage to be able to count the number of votes and average per company.
PivotTable can do the job. All you need is a helper column using COUNTIFS. Notice the formula in cell D2.
And the PivotTable would look like this (set to Tabular Layout)
A note to take here is COUNTIFS can get really slow when the number of records grow to around 10k or more (or just my slow pc :/). When this happens, the workaround is: first sort your data, then use COUNTIFS over a limited number of cells only. For example, at cell D2, the formula will be =COUNTIFS(A2:A102,A2,B2:B102,B2), hence counting only 100 records rather than the whole bunch as you fill down the formula.
If what you want is the number of votes and average per company, that can be done in a variety of ways.
Using a Pivot Table, drag companies to the rows area; drag rating to the values area twice. Then change the Value Field setting on one of the Ratings to Count; and on the other to Average.
Add some formatting and various options gives you:
Or if you have a list of the Organizations (Company Names) in, let us say, G3:Gn, and your data table in columns A:C, you can use formulas:
Count: H3: =COUNTIF($B$1:$B$1000,G3)
Average: I3: =AVERAGEIF($B$1:$B$1000,G3,C1:$C$1000)
And fill down as far as needed.
Since you mentioned a PT did not suit , assuming RATING is in F2, please try in G3 copied down to suit:
=IF(AND(COLUMN()-7<COUNTIF($E:$E,$E3),$E2<>$E3),OFFSET($F3,COLUMN()-7,0),"")
then drag all the formulae to the right until an entire column appears blank. Note this requires the TARGET ATTENDEE ORGANIZATION column be sorted.

Is there an easy way to reformat a poorly-formatted tree to a two-column table?

I have a table representing a series of components and their subcomponents, and the subcomponents' respective subcomponents, and so on. It currently looks like a tree (one-to-many relations), but it could change at some point to resemble a graph (many-to-many relations) instead. Unfortunately, it was poorly formatted by its author, and looks something like this:
The above format is poor because there is a lot of data duplication and it is limited to a set number (4) of tiers. I would instead prefer if it looked something like this:
The above format is nice because there is very little data duplication, and it is not limited to a set number of tiers.
In case there is any confusion about what the tables represent, here is a graphical representation of the data:
It is simple enough to convert from the poor format to the nice format, but there are hundreds of root components, and manual data entry would be far too time-consuming and tedious.
I suspect this problem is unique and I am prepared to write some VBA code myself to parse the table into the nice format, but I thought I'd make sure that this wasn't a common problem with a pre-rolled solution before I rolled my own.
Is there a technical term to describe the poor formatting in the first table? Is there an easier way to reformat the data than to write a VBA macro?
This may be a complete aberration but it works for your sample (and at the moment I don’t have time to break it!)
Add an index (and a label for it) and reverse pivot (eg see An excel formula to find a row/column index in array).
Instead of drilling down on the Grand Totals intercept, drill down on each of the totals for the Tiers.
Reassemble the tables side by side, delete all columns except the Value ones and copy table to another area with Paste Special Values. Remove Duplicates on the range. Every time the value in the column immediately to the right does not change, delete and shift the values in the cells to the left. Reorder the columns right to left.
I copied each pair of adjacent columns in the Tier table (Tier 1 & Tier 2, Tier 2 & Tier 3, Tier 3 & Tier 4) and pasted them stacked vertically into a single pair of columns (Subcomponent & Component).
Next, I removed duplicates by selecting both of my new columns and clicking Remove Duplicates in the Data ribbon tab.
Next, I had to remove all rows which contained a blank cell in the Subcomponent column. To do this, I selected both columns again and filtered the data by clicking Filter in the Data ribbon tab. I selected (Blanks) in the Filter menu on the Subcomponent column and deleted all visible rows. I removed the filer by selecting (Select All) in the filter menu.
The resulting table contained many blank rows, so again I removed duplicates, and then manually shifted the data up one row to displace the one remaining blank row.
In the end, it took about a half hour, which is probably less time than it would have taken me to code a macro, and definitely less time than manual data entry.

Resources