-
1. Re: How to count the number of different categories within one dimension
Mahfooj KhanMay 25, 2016 9:09 AM (in response to Sebastian Hopfensperger)
Yeah this can be done! Can you share your sample data in text format or share the workbook in .twbx format?
-
2. Re: How to count the number of different categories within one dimension
Sebastian Hopfensperger May 25, 2016 9:23 AM (in response to Mahfooj Khan)I am unable to share the data/sample as it is sensitive to exposure and confidential, is there an easy way to explain?
-
3. Re: How to count the number of different categories within one dimension
Mahfooj KhanMay 25, 2016 9:30 AM (in response to Sebastian Hopfensperger)
I'm not asking you to share the exact data just create few columns and rows with the same format with dummy values. Just 10-20 records.
-
4. Re: How to count the number of different categories within one dimension
Mia Lee May 25, 2016 9:33 AM (in response to Sebastian Hopfensperger)Hi, Sebastian
You may try creating those 2 calculated fields as follows,
Sales Count of A =
If dimension='A' then count([Sales]) else 0 end
Sales Count of B =
If dimension='B' then count([Sales]) else 0 end
Please let me know if this helped.
-Mia-
-
5. Re: How to count the number of different categories within one dimension
msa s May 25, 2016 9:41 AM (in response to Mia Lee) -
6. Re: How to count the number of different categories within one dimension
Sebastian Hopfensperger May 26, 2016 2:13 AM (in response to Mahfooj Khan)Ok so attached is an example workbook and the data file. Basically you will see that I already have two measures, Invoices and Orders which I need displaying like they are next to each product. I have then counted the number of sales in each one which in this case is 1 for each product (the real data is one line for every product therefore there is more than one by each product). However, I would like to make a calculated field that only counts A, and only counts B separately, so that I can name them Sales A and Sales B in the columns, much like Invoices and Orders. Thanks for you help.
-
Tableau Example.xlsx 8.6 KB
-
Tableau Example.twbx 24.9 KB
-
-
7. Re: How to count the number of different categories within one dimension
Sebastian Hopfensperger May 26, 2016 2:13 AM (in response to Sebastian Hopfensperger)I have managed to do it using Count and IF functions in two separate calculated fields:
Count(IF [Sales] = 'A' then [Sales] end)
and named the Field Sales A
Repeated for Sales B
Thanks for the Help
-
Tableau Example.twbx 25.4 KB
-
-
8. Re: How to count the number of different categories within one dimension
Mahfooj KhanMay 26, 2016 2:31 AM (in response to Sebastian Hopfensperger)
Yeah Its correct!