6 Replies Latest reply on Dec 8, 2017 6:02 AM by Tony Fahd

# Calculate unique patients and percentage?

Hi,

I am attaching a workbook where I like to calculate the percentage of customers that had one of the test by category. so I have three test driving test, hearing test and reading test. I have a category field. each customer falls under one category. i have three categories (as you see in the filter)

i like to get a percentage of customers that had each test by category so when filter on each category, i can see the percentage of customers by category for each test.  there are 13 customers under category 1, 11 under category 2 and 12 under category 3. so i want that percentage of customers to be populated whenever i filter on category. does it make sense?

Thanks for the help

Test                unique customers        percentage of customers by category

driving test             10

hearing test            14

• ###### 1. Re: Calculate unique patients and percentage?

is this what you are looking for?

-AV.

• ###### 2. Re: Calculate unique patients and percentage?

Thanks, how did you get the percentage?

i would rather create parameter for each category so three parameters (13,11, and 12) and have the percentage populated based on category. does it make sense?

• ###### 3. Re: Calculate unique patients and percentage?

Refer to the screenshot attached below:-

Also attaching the .twbx its in v10.4

Regards,

-AV.

• ###### 4. Re: Calculate unique patients and percentage?

Thanks. I like to to be able to get the percentages using parameters for each category. is this doable?

• ###### 5. Re: Calculate unique patients and percentage?

first to get unique customers you need to write lod function with countD.. once you get unique percentage then you can display that as count or percent of total...

{include [category],countd(customerid)}... this will give the exact result which you are expecting.... if you are displaing category in your data you can ignore lod and just use countd[customerid]... it will do for solution

• ###### 6. Re: Calculate unique patients and percentage?

thanks but I like to use the number of patients by category using 13, 11 and 12 for each category and not use the number in the data. so it's either i have to create parameters and use them to display percentages when i change the category filter or use an If function that says:  if category is 1, then (countd patients/13), else if category is 2 then (countd patients/11) else if category is 3 then (countd patients/12)

i can't have it to work though.