Search code examples
fixedpercentagedashboardtableau-api

Tableau Subset Percent Calculation


I have a dataset of training which is by location and it has a status variable which contains "complete", "Not started", "expired", elasped" & "In progress". I made a unique variable which i called "staff" and used "distinct count"to count the staff as a measure. Sample of the data layout below

Status    location   id  family  staff
complete  abc        1   abcd    xxxxx
expired   abb        2   abcd    xxxxx

I have a completion overall percentage for each status but i also want a percentage for just "complete", "In progress" & "elasped" based on the grand total which i can't get to work. I tried to fix to status and count but I don't get the correct figures. I also tried to make a group with the 3 status but when I go to a new worksheet to complete the calculation the grand total figure is also filtered by the group.

   {FIXED [status],:count([staff])}

I am new too tableau but this seems like it should be easy but I know LOD is tricky.

Any suggestions would be helpful.


Solution

  • If I understand correctly, you want a distinct count of [staff] that have a [Status] of complete, In progress, or elapsed divided by the overall distinct count of [staff] (any status). If yes, try the below:

    COUNTD(IIF([Status] = "complete" or [Status] = "In progress" or [Status] = "elapsed",[staff],NULL))
    /
    COUNTD([staff])