Identify missing Dimension Value in Tableau - tableau-api

I have student name, subject and marks in three columns. My use case is to identify the subject in which selected student has not enrolled. I can do it very easily using SQL but requirement is to identify it in Tableau. I have tried LOD's and Traditional Filters but it's of no help.
**Sample Data**-
Name Subject Marks
Rob A 90
Rob B 95
Rob C 98
Ted B 86
Ted D 70
**Desired Output**-
Name Subject
Rob D
Ted A
Ted C

If graphical solutions are also an option, you can print the Subjects on e.g. the X axis, and the Student Names on the Y axis. Then, set the marks type to e.g. text and display the Number of Records in each cell. This way, you should get a matrix of all Subject vs. all Students, with 0 or 1 in each cell (intersection).

Related

Tableau rotating data table

I have a dataset that looks like this in Tableau.
Name Subject Grade
Mina Math 28
English 92
Science 10
Bill Math 19
English 10
Science 38
Kay Math 39
English 92
Science 83
I need the data to look like this
Name Math English Science
Mina 28 92 10
Bill 19 10 38
Kay 39 92 83
How can I do this in Tableau? I am assuming I need to create a calculated field. Just not sure how to approach this as I am a beginner.
As Alex Blakemore suggested, you could pivot your entire dataset in the data source page itself, but I am assuming the first view you have is a Worksheet with Name, Subject, Grade fields in columns of the worksheet, and you would like to present your data as in the second view without modifying your data source.
It's possible by creating three calculated fields:
Math:
IF [Subject] = "Math" THEN [Grade] END
English:
IF [Subject] = "English" THEN [Grade] END
Science:
IF [Subject] = "Science" THEN [Grade] END
Now try dragging Name, Math, English and Science fields into the columns of the Tableau Worksheet and you should be able to get what you need without actually pivoting your data source itself. Hope this helps!

Tableau stacked and side-by-side bar chart on column aggregation

I have a data set like this
Name Occupation Payment Principal Interest
Amy Nurse 100 90 15
Becky Teacher 80 100 20
Catherine Nurse 90 75 15
John Engineer 90 80 12
Tom Teacher 120 100 20
... ... ... ... ...
I'd like to create side-by-side(Payment) stacked chart:
Row: Occupations
Column1 : stacked(Sum of Interest and Sum of LP Principal) by occupation
Column2 : Only Sum of LP Payment by occupation
Can anyone give me hint how to make it?
Your data is not in the correct format for the required chart and you need to do some data prep.
Pivot all three measure fields from the data source page.
create a calculation to define the column for each data type
Build the chart as below and hide the header for column field.
One approach that avoids reshaping your data is to use the measure names and measure values placeholder fields to create the stacked bar chart.
See below

Tableau - Name Rank, by State / Year / Gender

I have a data set downloaded from the Social Security website. The data is in the form below, and contains the popularity (i.e., as defined by Count) of names, by gender, year and state:
State Gender Year Name Count First Letter
AK F 1910 Anna 10 A
AK F 1910 Annie 12 A
AK F 1911 Annie 6 A
AK F 1912 Alice 5 A
AK M 1912 Wilbur 7 W
AK M 1912 Thomas 7 T
Within Tableau, I'd like to Top X names by each of these categories (or all if not filters are applied). However, when I use a Top filter in a visualization, the underlying data produced by the filter is the form:
For example, I need the first ranked name, and be able to use filters to see how that changes by year, gender, and state. I'm thinking this might be accomplished by an LOD expression, but not sure where to start.
You can achieve this without needing a LOD calculation. Simply change your filters from standard blue dimension filters to be context filters. To do this simply right click on the filter when it is in the filter pane and click "Add to Context". The filter will be shown as grey. Now all ranks will be calculated after filters have been apllied
Why does this work? It is to do with the Order of Operations in Tableau. A calculation such as rank is a table calculation. As the name implies the calculation is processed on the entire data table before dimension filters are applied. However, when something is a context filter it creates temporary tables which are then used to calculate table cals.
Find out more here: https://www.google.com.au/search?q=order+of+operations+tableau&oq=order+of+operations+tableau&aqs=chrome..69i57j0j69i65j0j69i65j0.3475j0j7&sourceid=chrome&ie=UTF-8

Specific grouping in Tableau (Heatmap)

I would like to join an Excel dataset which contain (but I don't know if its possible in here) :
The name of a course
The ID of a problem from this course (many pb per course)
The ID of a user that has submitted an answer for this problem from this course
the grade that the user has obtained at this pb from this course
What I try to achieve, it is a graph like those ! It's supposed to be call : Gradient-map, Colormap or Heat-map.
Axe x : Every problem for each course
Axe y : value of the grade (from 0 to 100)
Axe z : Number of user for each Note value
So, if for the pb A of the Course A, the dispersion is like this:
9 users have 100
21 users have 80
40 users have 60
5 users have 40
10 users have 20
15 users have 0
I would like to have every value displayed on a bar and each value would be displayed by a square. Each square having a different color regarding the value represented.
So, here, 60 would be darker than any other value (since the amount of people having this grade is the greatest) and 20 would be clearer than 0, 60, 80 & 100 but darker than 40
Then, just next to this bar, the same but for the pb B & C. Then, next to it, the pb A, B & C for the course B, etc
Move grade, name of a course, ID of a problem to Dimensions.
Put name of a course and ID of a problem on the columns.
Put grade on the rows.
Find a drop down list on the Marks tab and select Square.
Put COUNT(ID of a user) on the Color on the Marks tab

JasperReports Crosstab Query

I'm using JasperReports \ iReport crosstabs to create a matrix of student and results.
So for example Jim is doing subjects A, B, C and Sally is doing A, C
What I want is something like:
Subj-A Subj-B Subj-C
Jim P M D
Sally D D
But as my SQL orders by name then subject I get:
Subj-A Subj-B Subj-C Subj-A Subj-C
Jim P M D
Sally D D
As you can see in the above the results are correct but the formatting is woeful.
Is there anyway I can generate the reports to use names and subject only once
and filling in the values from here?
To follow-up on this.
JasperReports is primarily used to represent the data so the work here needs to be done here via the SQL.
In a case where there is a crosstab of X vs Y we may need to use a cross-join which bacically compute all the combination of X subject and Y students.
After the cross-join we can use an outer-join on the candidate details to find there results. After this it is a basic matter of representation in Jasper.