add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
8 rows affected
ITKey ACCOUNTS HR PAYROLL
3 33.333333333333 0.000000000000 66.666666666666
with cte as
(
    select it.Unique_Key, ot.System_Name
    from   data it
           left join data ot on it.Unique_Key = ot.Unique_Key
                            and ot.System_Name <> 'IT'
    where  it.System_Name = 'IT'
)
select [ITKey] = count(distinct Unique_Key), 
	[ACCOUNTS] = count(case when System_Name = 'ACCOUNTS' then Unique_Key end) * 100.0  / count(distinct Unique_Key),
	[HR] = count(case when System_Name = 'HR' then Unique_Key end) * 100.0  / count(distinct Unique_Key),
	[PAYROLL] = count(case when System_Name = 'PAYROLL' then Unique_Key end) * 100.0  / count(distinct Unique_Key)
from   cte;

Warning: Null value is eliminated by an aggregate or other SET operation.

ITKey ACCOUNTS HR PAYROLL
3 33.333333333333 0.000000000000 66.666666666666
Warning: Null value is eliminated by an aggregate or other SET operation.