I am using this query to count the frequency of each "CPV" in cluster by using "total = 238" which is the number of distinct contract :
MATCH (c1:Contrat1018)<-[r:HAS1018]-(p:CPV1018)-[x:HAS1018]->(c2:Contrat1018) with distinct p.id as CPV , collect(p.id) AS Total , tofloat(count(p.id)) as Occurence , c1.clusterId as Cluster , c2.clusterId as Cluster2 , 3980 as total where Cluster=Cluster2 return Cluster , Cluster2 , CPV , Occurence , TOFLOAT((Occurence / total )* 100) as frequence order by Occurence desc
But the result that I am getting is the frequency of each CPV in all clusters . And what I really need to have as a result is the frequency of CPV in its cluster (in the cluster where he is working )
Here is the result that I am getting btw :
I need your help please :) thanks in advance !