Why are my TABLEAU table aggregation attempts ignoring my filter? - sql

See attached image. Via Coursera, I am new to Tableau so what I am attempting to do seems it should be rather simple to do but isn't (not intuitively so). I'm familiar enough with SQL to wrangle my way around subqueries and case statements and such, but Tableau feels far more clunky most of the time.
Screenshot of Tableau worksheet table
I simply want to aggregate the dollar amounts listed on the right, SUM'ed across each City partition. Each city has a number of properties that have already been purposely filtered out, based on their profit Rank (via calculated fields) being too low. I've tried all sorts of things, but *the issue I'm facing is that the closest I can get is that any SUM I do lumps in the properties that were filtered out despite the filter remaining in place on the Filter card *. (I think I got a Running_Sum to yield the correct city totals a couple of times, but I couldn't get it to only show a single row of the final value for each city.)
I've tried countless variations and combinations of Include, Exclude, Fixed, Case, If, some nested via one or more of them, some not nested at all, some within a single calculated field, some spread out across multiple calculated fields...and often getting errors regarding not being able to mix aggregates and non-aggregates, being required to use aggregates in LODs but not being able to do so with IF statements, etc. But again, the times I've been able to get it to "work" error-free, I get the SUM across all properties in the city..not just the ones in the 'INVEST' category that the filter suddenly ignores after any error-free modification attempts to what is seen here.
Any help regarding this specific issue would be greatly appreciated, but a more general understanding of how to keep filters from being conditionally ignored by Tableau would be great. Sometimes the filter variable's second category would disappear as an option altogether while Tableau would still use rows from that category in the calculation. What gives? Thanks!

Related

Why are my measures returning null in my MOLAP cube in SSAS?

I have a cube with a fairly simply structure:
My measurements are also very simple, I just have a sum and a count of the grades.
However when I try to deploy the cube, it returns null values for the measurements:
As you can see, I even had to enable show empty cells, otherwise it wouldn't even show any results and just state "No rows found. Click to execute query.". Even if I try to simply retrieve the student_id for example or any other column without using any measurements, I get the no rows found statement unless I toggle the "Show empty cells" button.
What could be the reason for this?
I checked if aggregation was enabled for all dimension and it was. Connections between the tables are also okay, I checked it one by one and even in practice you can see how selecting both from teachers and students works perfectly well:
It's also worth mentioning that previously the cube was working. I tried adding some calculations then removed them once I noticed that the cube wasn't working properly. Right now there are only measurements in the cube but it still doesn't work as expected.

Dynamically creating a pivot table using fuzzy matching

So, I'm constantly being given data in new and different formats. I'm on a crusade to get my work to standardize data for easy use, and if I managed to convince the powers that be to standardize data, this problem becomes entirely moot. Until then, I have the following problem:
I get data in a variety of ways. Sometimes my gross sales are called total sales. Sometimes gross sales before discounts, total sales before discounts, Gross_Sales, etc. Discounts, deductions, exempt amounts, etc. form another column. So on and so forth. I'd like to be able to do the following:
1) Figure out what columns I want,
2) Turn those columns into a pivot table.
For part 1, I have two options, and I'm wondering if there's anymore: The 1st is to use Microsoft's fuzzy-matching add-in to help me match. I'd have a separate tab dedicated to fuzzy matching each column I need. The second is to just generate a long list of all the variants, and to test each one until I find a hit, assign it, and move onto testing the next one.
The second part is turning all of this into a pivot table - the resouces I have so far are https://www.thespreadsheetguru.com/blog/2014/9/27/vba-guide-excel-pivot-tables and How to Create a Pivot Table in VBA
Is there a better method? Is there another way?
Edit: Slightly better method - Grab the data columns, place them into a table, and pivot everything off of that table - it removes the need to re-create pivot tables, just need to move the data over.
Having the same problem, I use a mix of your two methods.
My data consists of a bunch of logs for rejected x-ray images, and the reject reason is a free text field. My solution was to create a table where the first column contains my desired output categories, and then each subsequent column contains a different variation of it.
For example, a row might have (column one/ouput first entry):
Positioning, POS, Positioning Error, Patient Positioning
Note that these are all fairly different from each other. Where the fuzzy matching comes in - it is used to capture all the smaller differences and mispellings around those other columns. When the fuzzy matching section decides a given reason matches a column's entry, it is then replaced with the appropriate desired output reason from column 1 of the table. In my example, a reason of 'Possitioning Err' [sic] would match to column 3 (Positioning Error) and then get converted to Positioning.
Then wash rinse repeat over the rest of your data as needed. This approach was super useful and fairly flexible in helping standardize my data. It was also computationally more expensive, but you'd only need to run the matching portion once I guess.
As for the actual mechanics of going about doing this - I use 2010, so no inbuilt functionality. I run the fuzzy matching code on a temporary worksheet until best percentage matches are found, and then overwrite the actual source data afterwards.

How to add a field to a report that has groups

I need to add a field to a SSRS report. I tried modifying the dataset (query) but the results prouduced insane results, with zipcodes showing up in the name fields and names showing up in a datetime field. I suspect it is because of the groups but I don't understand how they work. The Dataset is created by 4 selects. The first 3 insert into temp tables and the fourth pulls from it. I suspect that I will have to re-write the query but it would be nice if I could use it as is with modifications. Either way I need to understand the groups.
I read
Data Region Cells, Data Region and Understanding Groups. Aside from the fact that they use terms specific to SSRS without defining them they are so undetailed I doubt many people who do not already understand SSRS can get anything out of them.
I did not write this report but I must modify it. I understand SQL well. Not so much with SSRS.
Can anyone explain how to find out what the Row Groups mean? Mine look like this:
Here is the tablix

How to display filtered data rows as a tooltip in Tableau Public?

Noob here, I have a table with different entries (rows) per different (repeating) regions.
I'd like to be able to display the data rows filtered - matching that particular region thanks - so I get those particular fields related to each region as a tooltip on a map. (I know how to build the map)
Thank you
Just dragging the fields you want to Details or Tooltip is not doing the trick?
Putting a measure on a shelf (other than filter shelf) includes that field in the visualization query results -- i.e. applies the chosen aggregation function to yield an aggregate result value for each partition of the data (as specified by the unique combination of dimensions)
Putting a dimension on a shelf (other than the filter shelf) also includes that field in the query results, but since the dimensions define how data rows are partitioned, it can affect the level of detail of the query. You'll notice this often as suddenly getting many more marks in your visualization after you add a dimension to a shelf. If you are familiar with SQL, dimensions define the fields that follow the GROUP BY keyword.
EDIT
Thanks for the addition, #AlexBlakemore. I've never said dragging a dimension would not work, only that it wouldn't work as the OP wanted it to (basically the same as you're saying).
And though everything you said (above) is true, it's particularly not exact when it comes to maps. Yes, dragging a dimension will further partition the data, but it will not create additional marks on a map (unless it has also geographical properties). Rather, the tooltip will get the first occurrence of that dimension, and display data for that only. For instance, if you drag "Product" to details, and the possible values are "Bread", "Coffee" and "Milk", it will probably just show "Product: Bread", and the measures for "Bread" only. So yes, it will partition, but no, it won't create additional marks.
Back to OP problem. What I believe you want is a tool tip with all values of the dimension (in my poor example you'd like to see "Bread, Coffee, Milk"). Tableau does not have functions to aggregate strings yet, so it's hard to do so.
What I would suggest is to create a separate sheet, and just drag the dimensions and measures you want to rows. Then put it side by side with the map on a dashboard, and use the map as a filter. Then, when you click on a country/region/city, you'll see the data of that region on the other chart.
Refer to: http://kb.tableausoftware.com/articles/knowledgebase/creating-filter-actions-dashboards
or https://www.tableausoftware.com/learn/tutorials/on-demand/authoring-interactivity

Creating a Calculated Field between 2 datasets in SSRS 2008 R2 Express

I have a very simple task. I have two datsets. The first is a single value that has returned me a number of calls that has been made. The second is a list of targets. I want to be able to divide the first number of calls by its call target in order to calculate the total %.
The lookups of these are dependant on the criteria that is selected in the report itself. I know it's possible to do inside SQL its just a huge pain in the ass. I want to be able to calculate two fields and I thought something so simple would be a breeze for SSRS but apparently not. So the error i get is:
*The expression used for the calculated field'=fields!DMCP.Value / FIRST(Fields!DMCTarget.Value,"AllTargets")' includes an aggregate,rownumber,runningvalue, previous or lookup function. aggregate,rownumber,runningvalue, previous and lookup functions cannot be used in calculated field expressions.*
I can take the first function out but it doesn't help me. It says it can only calculate in the same dataset, problem is these values can never co-exist in the same dataset. Anything I can do????
Thanks in advance