Reputation: 7189
I am given the task to combine queries to make it a dashboard in tableau.. something like this.
Total_count total_active total_inactive Active% inactive%
100 20 80 0.5 0.8
The above results are obtained by executing separate queries..with filters applied
how can i combine them into a dashboard..
Ex:
select count(id) from table -- gives me 100( Total_count)
select count(id) from table where status like '%Active%' --gives me 20(total_active)
(Total_count)-(total_active) gives me inactive..
Active%=total_active/Total_count
Inactive%=total_inactive/Total_count
But i am not able to put in dashboard..(or make reports)
how do i get Total_count and Total_active in one sheet
when i create a filter on status column(Active)..it applies to Total_count also?
is it possible to create calculations across sheets?
say in sheet i got count(total_customers) in another sheet i got count(Active_customers)
now i need to substract values from these 2 sheets how do i do it?
Upvotes: 0
Views: 347
Reputation: 2275
Slow down, you . Why are you querying? You can make all this calculations in Tableau in simple ways (actually it doesn't involve formulas).
So, I assume your table looks like that (correct me if I'm wrong and I can help you better):
Id Status 1 Active 2 Inactive 3 Active 4 Inactive
Just connect to this on Tableau (don't query anything)
So, there are many way to show this on a chart. What I would do is put Status in Columns, and Sum(Number of records) in the row (just drag Number of records to rows, it will automatically measure it as sum). If you have duplicated entries of Id, you can use Countd(Number of records), again just drag and drop, and select countd measure.
For the %, I would just include then in label. First I would drag the SUM(Number of records) to the labels (hold ctrl so you don't lose it from the chart). Then I would add a table calculation: Percent of Total. This will show the percentage of active and inactive ids in their respective columns.
If you want to keep both the absolute and percentage values, just drag both to the label, and edit it as you wish (I usually put absolute above, and % below between parenthesis).
Upvotes: 1