1 Reply Latest reply on Sep 26, 2018 8:44 PM by swaroop.gantela

# Get percentage from count elements

Hi everyone,

I´m trying to obtain a percentage of task ended at time, compared with the total of task in the period selected (month, quarter, year)

I can show the total of task asigned (Counter) and ended (CounterAtTime), as in the image:

Now, I want to show the percentage of ended task for period compared with total asigned task (CounterAtTime/Counter), but I obtain wrong values:

As you can see, for example, for august, the total of asigment task are 52, and ended task are 5. If divide this numbers obtain 5/52=0.096=9.6%

But in the second graph the value remain 5 as in the first graph.

I cant understand Why happen this, if someone can help me I´ll be grateful. I attach the workbook in Tableau 10.4

Thanks

• ###### 1. Re: Get percentage from count elements

Orlando,

I think it may have to do with CounterAtTime:

IF ATTR(DATEPART([Select period],[Date]))=

ATTR(DATEPART([Select period],[Real Date])) THEN

COUNTD([Id])

END

I think this will get calculated on an ID level, and so each one

that meets the criteria will yield a COUNTD of 1.

With ID on the detail shelf, that means the 5 copies of 1

are getting stacked up.

Instead, I tried aggregating outside of the conditional:

COUNTD(

IF DATEPART([Select period],[Date])=

DATEPART([Select period],[Real Date]) THEN

[Id]

END)