Tableau attribute assignment - attributes

I have a simple dataset of six people
Person 1, City 1, College Yes
Person 2, City 1, College Yes
Person 3, City 2, College Yes
Person 4, City 2, College No
Person 5, City 2, College No
Person 6, City 3, College Yes
And what I want to do is end up with a new table that has the city, and a new variable that looks if everyone in that city went to college ("Yes" or "No")
City 1, AllInCollege Yes
City 2, AllInCollege No
City 3, AllInCollege Yes
This is all done in Tableau. I'm struggling to create the calculated field that I will need. Thanks!

One easy approach is to use ATTR(College) -- i.e. put College on the shelf that you wish and change it from a dimension to an attribute. Then it will display "Yes" if all rows for the specified dimensions had "Yes" in the College field. Or it will display "No" if all rows had "No" in the College field. Or it will display "*" if the rows were mixed, some Yes and some No.
Or you can create a calculated field called, say everyone_went_to_college, defined as count(City) = count(if College = "Y" then 1 end)

Related

GSuite App Maker - how to pivot datasources

I have a simple app that takes attendance for a list of students. There are two datasources, a students table with first name, last name, id, and site, and an attendance table with first name, last name, date and present.
I want to be able to log attendance by getting a list of the students, entering a date, and check a box if they're in attendance or not (boolean column).
What I would like to do is pivot the attendance date for a new view so that instead of having a column with distinct dates, I'll have a columns for each date showing the value of the checkbox.
Ex:
Attendance 1:
First Last Date Present
Bob Smith 10/1 0
Bob Smith 10/2 1
Bob Smith 10/3 1
Kevin Brown 10/1 1
Kevin Brown 10/2 1
Kevin Brown 10/3 1
New Pivoted View:
First Last 10/1 10/2 10/3
Bob Smith 0 1 1
Kevin Brown 1 1 1
Is there a simple way to get this result in App Maker?
EDIT: For clarification. The primary purpose of the app is to capture attendance data in a classroom setting. So there is a flow where a teacher pre-populates a list of students and then checks the boxes down the line to log where a student was present/absent.
What I would like to be able to do is provide a page that presents the attendance data in a wide format so teachers can also look across the columns to see who was there on a given day.

Extract top 5 url based on their associated values (score)?

I'm trying to develop a formula that can sort my data with different categories based on several conditions.
Here's my data and the result i'm looking for: -
-
My urls contains "car" or "banana" AND "1" or "2" so i need to sort it with those categories :
Banana -1
Banana - 2
Car - 1
Car - 2
And I need to sort it by desc, based on the score of each URLs.
It's been a day i'm working on it and I still can't figure it out :(
Thanks in advance for your time and consideration!

Excel - Duplicate Data

I don't have much experience with Excel and I need to solve an issue
Our sales Excel sheet has the following
Product Name | Item Sold Price | Unit Cost |
Product 1 £5 £3
Product 1 £9 £3
Product 1 £4 £3
Product 1 £12 £3
Product 1 £10 £3
We want to remove duplicate data and combine all duplicate items as one product and work out the average Item Sold Price.
Likely easily solved In two or three clicks with a pivot table depending on what you mean by duplicate. What would the answer be in the example you have given ?
The solution you looking for is called as "Pivot"
you can refer here to find out how pivot work
You mean, you want a result like this?:
Product Name | Item Sold Price | Unit Cost
-------------|-----------------------------|--------------------------
Product 1 | AVERAGE(5, 9, 4, 12, 10) | AVERAGE(3, 3, 3, 3, 3)
It can be done using pivot table...

Filter rows in excel which have start but do not have end

Let's say, I have 2 tables
First table: person, start date
Second table: person, end date
I want to find persons which have a start date but do not have an end date.
Example
First table
Person 1, 01.01.2015
Person 2, 02.02.2015
Person 2, 03.03.2015
Second table
Person 1, 10.01.2015
Person 2, 10.02.2015
Result
Person 2
I'd suggest making a third results table, of the following form.
Person; Count of start dates; Count of end dates; Difference
Person 1; 1; 1; 0
Person 2; 2; 1; 1
Where person is a unique list of all the names (combined from both tables), then use countif functions to get the counts and one minus the other to get the difference. Any difference not equal to zero is an issue.

Excel Charts for table with many duplicates

I have a list of names with 1000 entries and maybe 750 unique. There are other attributes, like location and position. Can I create a pivot table that would show me simple stat's like X number of unique people, X number unique in location 1, location 2, location 3, and finally x number of positions in location 1, position 2/location1, position 3/location2...?
Name Location Title
Smith, Bob UK Sales Manager
Smith, Bob UK Plant Manger
Jones, Keith UK Sales Manager
Jones, Keith UK Plant Foreman
White, Derick Denver Sales Manager
Brown, Frank Boston Supply Chain
Black, Jay Denver Sales Manager
Smith, Jeff Denver Sales Manager
Gonzalez, Al UK
Gonzalez, Al UK Staging Area Manager
Bright, Susan Denver Legel Secretary
Bright, Susan Denver Paralegal
Bright, Susan Denver Executive Assistant
Bright, Susan Denver Press Secretary
Alf, Jeff Denver VP, Sales
Green, Burt Boston VP, Sales
Jones, Chuck Denver Plant Foreman
Alten, Cory Denver Sales Manager
Clark, Jerry Boston Plant Foreman
Romo, Tom Denver Sales Manager
You may want to consider using CountifS functions in adjacent columns to the data. For example to count unique people, just create a column (call it column x for this example) and enter =Countif(Column A, A1) and copy down for all the rows. then just enter =countif(Column X, 1) and that should give you the unique names.
You can use CountifS function for more complicated counting logic to answer the other questions.
I have done similar counting of unique entries using pivot tables.
I create a additional column that has a 1 if it is the first occurance of the "key" (ie name). The formula is similar to this: (assume Column A has the "key")
=IF(ROW(A1) = MATCH(A1,A:A,0),1,0)
This formula is then copied down for every row (or if it's a proper table, it's auto copied!)
The idea is that the MATCH returns the row number of the first occurrence of "key". If it is the same as the current row, then count 1. If the values aren't the same, it's a duplicate, so give it a 0 value.
When you then do a pivot table sum on this value, it adds up to the number of unique entries. (ie unique names in a region.)

Resources