Hey ram ,
Would the build in contribution function not work for you? (https://docs.sisense.com/main/SisenseLinux/dashboard-functions-reference.htm#StatisticalFunctionsSupportedbyElastiCubeandLiveModels)
it automatically calculates the percentages.
If it doesnt work, you can divide those 2 functions and format the measure as percentage (e.g. Count(pens)/(dupcount(pens),all(tasks))
I assume that tasks is a category. So to calculate the percentage of pens per task the division needs to include all tasks.
Hamza