tableau Show the top 3 products for each of the top 5 vendors - group-by

I'm not sure how to go about this in tableau.
Using something similar to the superstore dataset, I want to make a table of the top 5 vendors (lets say by sales) and the top 3 products for each vendor (by sales for example).
The table might look like this
(Vendor, Product, Sales)
(Target, Ice Cream, 1000)
(Target, Spoon, 500)
(Target, Whipped Cream, 200)
(Walmart, Chair, 800)
(Walmart, Cereal, 400)
...
How can I do this in tableau?

You can try a combination of INDEX() and RANK() functions in Tableau
Read here: https://kb.tableau.com/articles/HowTo/finding-the-top-n-within-a-category?_ga=2.191851370.1706705908.1660100088-182821433.1653648634
https://youtu.be/z0R9OsDl-10

Related

Calculate total through datasheet and subdatasheet in MS Access

I have an table (OutgoingInvoice) with each invoice total. The other table Products contains all the purchased product linked to the OutgoingInvoice table (where we sold):
How can I calculate and display the profit? (OutgoingInvoice.SUMSUM minus All linked Product's SUM)
Is it possible to hide some Subdatasheet columns?
Edit:
- I can't use Dsum cross tables (expression builder do not allow it)
- So I decided to use query with Subdatasheet. Its working except 1 thing: The Subdatasheet not filtered (to show only a proper InvoiceID-OutgoingInvoice)
How can I do it?

How to filter top customers within certain section in Tableau

I have a Tableau file whose source is from one Excel sheet as shown below:
And it's how it looks in Tableau:
I have a Tableau sheet to show me the top 3 customers in each section. For example, company F, H, J, B, A are in section XXX, I filter section XXX only, sort F, H, J, B, A, select the top 3 customers and hit "keep only". So I have a table of top 3 customers in XXX section. Please see the pics below:
My question is, every month I have an updated Excel sheet with same format and I feed it into Tableau, the sales change every month but I always want top 3 customers in each section. For example, top 3 customers this month in XXX section are F, H, J but next month it might be A,B,H. However since I use "keep only" to filter F, H, J, the top 3 customers can only be F, H, J unless I manually change the filter. Is there anyway I can program Tableau to pick up the top 3 automatically whenever I feed new data to this file? I know "filter top n by" can do it but it can only filter by one variable, like they can only filter by sales instead of sales AND sections. I want to use "by formula" in the pic below to do it but I am not sure how to write the formula.
Have you tried to use the "Top" instead of "Condition" tab? You could also try to use a rank.
Create a calculated field "Rank", put index() into it, make it discrete and put it between your segment and customer pillow. Untick "Show header" and use it as a filter on the filter shelf.
I would use the Quick Table Calculation Rank. To do this create a new worksheet as follows:
Drag Section onto Rows
Drag Customer onto Rows
Drag Sales onto text mark
Drag sales onto detail
Right click the sales that you have dragged onto detail. Select Quick table calc and then rank.
Change this table calc from the detail mark onto the rank mark.
Now you can see what it is doing my default. You can see that is will be calculating the rank across all sections. As you mentioned you want the rank per section you just need to adjust the way the quick table calc is working. To do this right click on the measure and select edit table calc. Under Compute using you can change the way the calc is working. Select a couple of different ones to see what is happening. As you have structured the workbook to have Section and then Customer on the Rows shelf you should be able to use pane across then down. This means that it will calculate the rank per pane which in this case is per Section and will calculate down across Customer.
8) You can now drag this measure onto the filters pane and select a range of 1-3 this will filter the view to only show the top 3.
This method will work dynamically even when the data is updated :)

Grouping customers as "others" if sum of sales is below a value

I want to build a logic in tableau for grouping customers. Basically I want to see a bar graph comparison of customers sales with below logic:
Customers whose respective sum of sales is less than 100,000 are grouped as "Others" and shown as one bar
Customers whose respective sum of sales is more than 100,000 are shown as individual bars
Please let me know if there is a solution already discussed for this query or for any further details needed to support my question, thanks
if {fixed [Customer Name] : sum([Sales])} > 100000 then
[Customer Name]
else
"Other"
end

How do I add multiple subtotals in tableau?

My report has the following structure
ID , Currency, Subdepartment, Unit , Revenue, Salary
I wanted to print the subtotals of Revenue and Salary for the following combinations
(ID, Currency, Subdepartment)
(ID, Currency, )
The row has discrete dimensions hence the default grandtotal/subtotal option is not working .
is thr an alternate to calculate the subtotals and display beneath each grouping.?
If you're hoping to see this in a single worksheet, it sounds like a job for LOD (level-of-detail) functions. I'm not sure how you want to visualize it, but here's how you could simply make a table.
Create some calculated fields:
Revenue Total (ID, Currency)
{ FIXED [Id], [Currency] : SUM([Revenue]) }
Salary Total (ID, Currency)
{ FIXED [Id], [Currency] : SUM([Salary]) }
We can then create a table (for example) with the subtotals and totals by placing the following pills in the Rows shelf, in this order:
[ID]
[Currency]
SUM([Revenue Total (ID, Currency)]) (Make it discrete)
SUM([Salary Total (ID, Currency)]) (Make it discrete)
[Subdepartment]
SUM([Revenue]) (Make it discrete)
SUM([Salary]) (Make it discrete)
The resulting table will look something like this:
ID Currency Total Revenue Total Salary Subdepartment Revenue Salary
----------------------------------------------------------------------------------
A Dollars $200 $100 R $140 $30
S $60 $70
Manat ₼4000 ₼8000 R ₼1000 ₼7000
S ₼3000 ₼1000
Yen ¥500 ¥1000 R ¥100 ¥300
S ¥200 ¥500
T ¥200 ¥200
B Dollars $300 $700 R $200 $600
S $100 $100
Manat ₼7000 ₼3000 R ₼2000 ₼1000
S ₼3000 ₼1000
T ₼2000 ₼1000
Yen ¥900 ¥400 R ¥150 ¥100
S ¥250 ¥100
T ¥300 ¥200
All that said, FirebladeDan makes a great point in the comments of your question. Tableau is NOT Excel – it's a visualization tool, and a smokin' one at that. If you want to show aggregations of measures at different levels of detail, your best option (both in terms of what Tableau can easily do and the clearest way to visualize it) is usually going to be to create a dashboard with multiple worksheets at different levels of detail and to take advantage of filter actions and other controls to see how it all relates.

make a dashboard to has to make similar query too many times and performance bad

I have a question here. we have a customer list and product list and sale table. We want to show each customer to buy each product's total sale.
so I use the query like following:
select ...
from ...
where customer="" and product="".
the query is standard simple one. but the table/dashboard is 20*10. It means for each customer and product pair i have to run a query. i have to run query 200 times. which is super slow.
how to improve this? thanks
right now the dashboard give me 20 customer and 10 product and then i go to database for 200 times. it is from a customer list to pick first 20 and another 20 like this way. the product is the same way to choose.
You can use group by ... Something like
Select customer, product, sum(sales) -- or whatever you need
From ...
Group by customer, product
The server would do the aggregation, and the query is much faster than doing 200 queries