Tableau - different order of items when filtered vs not filtered - filter

I have a dataset where when the category filter is set to ‘All’ the data is sorted alphabetically, which is what I want. When the category is filtered to anything other than ‘All’ (about 30 distinct categories) I want the data in the view to be sorted by a dimension: rank, where each obs has a number ranking it in order of dollar value, within each category. How can I do this? If I sort by rank, it overrides the alphabetic sorting of ‘All’ when I need each in their distinct cases. Thanks!
Tried adding ‘category’ to rows so that I could sort ‘category’ in the filter, which is the only place I need it. But this overrides the alphabetic sort when the category is default ‘all.’

Related

Google DOC - Multiple FIlters combined

I'm a newbie when it comes to Google Doc Filters and I would appreciate some help.
I got a list with articles where I would like to filter by company (in this case SONY), but also filtering by lowest price combined with lowest shipping costs.
Example: the first filter I created, creates a list with SONY articles.
=(filter(A2:D12;A2:A12="SONY"))
Now I would like the filter to give out a single row, where the price and the shipping costs are the lowest, in this case, the product is:
SONY headphones with the price of 20 and shipping costs of 2,99
Im basically trying to combine the filters:
=(filter(A2:D12;A2:A12="SONY"))
=SMALL((C2:C12);2)
=SMALL((D2:D12);2)
in one single, long filter
Thank you
SEE SCREENSHOT HERE
Solution:
FILTER would not work in your case because you have a priority column to be filtered, in this case, column A before C and D.
You may use QUERY instead:
=QUERY(A2:D12,"select * where A='A' order by C+D limit 1")
This would select the entry with a specified value in column A (company), then order by the sum of C and D (price+shipping) in ascending order, and then output the first row, which is the minimum.
Sample Sheet:
References:
QUERY function
QUERY language

Sorting aggregate data in SSRS report

I have what seems to be fairly simple table in an SSRS report. My data query gives me a set of product names with a price column and category column. In my table, I have shown the categories as rows and the total price of all products in that category as data.
How can I sort the categories based on the largest aggregate sum of prices?
I've tried adding a sort expression to the category row group and the column group, but neither are working correctly. The sort expression is 'Sum(Product_price)'
My guess is that it's sorting based on the largest individual produce price rather than the aggregate, or something else entirely.
My recommendation would be to create a subquery in your sql statement that returns the sum.
SELECT T1.*,
(SELECT Sum(S1.YourFieldNameHere) FROM Products S1 WHERE S1.AValueToLinkWith = T1.AValueToLinkWith) AS Product_price_sort
FROM Products T1
Then use your new field in your sorting expression like any other field.
Fields!Product_price_sort.Value

Algolia sorting only ASC or DESC not both

I'm bit confused with Algolia settings releated to sorting, specifically in the dashboard I created new replicas, products_price_asc & products_price_desc. Then I come to the ranking formula and added a "price" attribute to the sorting.
However, it allows me to pick up the price attribute only once, so as to specify the sorting order of the price.
So the result is, that I have a dropdown menu with 2 options (price order ASC and DESC), but only one of them works correctly.
It's my first day with Algolia, so maybe I've missed something, but if anyone can explain me, how to implement this, I'll be happy.
Thanks in advance.
Creating replicas for sorting is the right first step: you need one replica per sorting order (in your case, one for sorting by price DESC, and one for sorting by price ASC).
But you need to update the Ranking Formula on the replicas themselves, not on the main index.
So, on products_asc, you should set this:
And on products_desc, you should set this:
Now, when you need to order results by ascending price, you should target the products_asc index for your search. When ordering by price descending, it will be products_desc.

How to sort in filter without using Dynamic Ranking in Endeca?

We are using Endeca to fetch and display records in frontend as a datagrid. In that datagrid, we have 10 columns and we display data sorted in table on the basis of 2 columns (say X and Y). For this, we use Endeca.stratify(collection()/record[not%20(X)])||X|1||*,Endeca.stratify(collection()/record[not%20(Y)])||Y|1.
We can also apply filter on the columns where we display data sorted asc/desc. We used Dynamic Ranking in Endeca and created dimensions for each field with selecting dynamic ranking and set maximum dimension value to return as 20 as per the requirement. Since we know that dynamic ranking is the relevancy ranking, it fetches most used records and does sorting on that data.
However, we need to select 20 unique values and sort them in asc/desc order. Example: if we have date as the column, then we need to fetch 20 unique dates with most recent at the top. i.e. in descending order.
Is there any other way to do sorting on filter apart from dynamic ranking? If we disable dynamic ranking, then we won't have option to set maximum dimension value as 20 from developer studio.
Please suggest for the ranking.
We finally found a solution!! I removed/unchecked "dynamic ranking" for the properties in dimensions from the pipeline using developer studio. I did not want it to remove since we had already selected an option as sort "alphabetically" instead of "dynamically" in dynamic ranking tab in dimensions.
Also, if we uncheck dynamic ranking then the option for giving maximum limit for displaying the dimensions (which was set 20 for us as per the requirement) was also gone.
So, I handled this in java to display only 20 values by putting a check on results obtained and created a counter which would add values only till the 20 are received. Now this is working as required!!!!!

Joining grouped tables

I have two different scripted data sets that I am pulling data from and aggregating (on the same key). What I want to do is to display one one line the aggregated data from both sources. The data is coming from a scripted data source (POJOs).
A simplified example is given below in which an Order has many Components, with each component being for a different customer at a different quoted price. Then when each Order is filled in different lots (or Fills) at different prices. I want to be able to produce a summary of each Order with the total Ordered and Filled quantity, and the weighted average quoted price and filled price.
An Order Component table
Order ID, Customer Num, Qty, Quoted Px
Ord01,Cust01,3,100
Ord01,Cust02,3,102
Ord02,Cust01,5,200
Ord02,Cust03,5,204
And then a Order Fullfillment table
OrderID,FillId,Qty,CostPx
Ord01,F01,4,100
Ord01,F02,2,106
Ord02,F03,2,200
Ord02,F04,8,210'
I would like to display something like this:
Order ID, Order Qty, Fill Qty, Avg Order Px, Avg Fill Px
Ord01, 6, 6, 101, 102
Ord02, 10, 10, 202, 208
I've tried using subreports and that seems to be able to get me the results but in a terrible format. The subtable headers repeat so every order gets it's own headers.
You may want to create a BIRT joined dataset between your two scripted datasets, based on a full outer join on the "order ID" column, and then use this joined dataset in your report. It should meet your needs.
I solved my problem by more or less following the following guide.
So I created a List linked to my first data source. I then added a group on Order ID so that I had one list row per Order. In the group header I added a 2x1 grid, I placed a table of the Order Components into one side of the grid and a table of Fills into the other. I had to add filters to both of these so that they only contained data for the correct OrderId. I then grouped the tables by OrderId, added my aggregation fields.
All that is left is to set the visibilty. So I set the visibility of the table details to false. In order to only show the table header once (instead of once per order) I added a Running Count aggregation to the List and set the visibiity to invisible when this aggregation was greater than 1.
Was actually quite easy in the end but took me ages to work out how to do it.

Resources