Forum Discussion
NuTek
9 years agoFrequent Visitor
Calculating overlap between selected groups
Given the following table and data: Group Task ===== ==== XYZ A XYZ C XYZ D XYZ E PDQ B PDQ C PDQ D PDQ E LUV ...
- 9 years ago
Hi NuTek,
You can use FIRSTNONBLANK/LASTNONBLANK function to get the first/last selected group.
First Selected Group = FIRSTNONBLANK(Table1[Group],1)
The formula below is for your reference.:smileyhappy:
% Overlap for first Selected Group = VAR firstSelectedGroup = FIRSTNONBLANK ( Table1[Group], 1 ) VAR count_of_overlap = CALCULATE ( DISTINCTCOUNT ( Table1[Task] ), FILTER ( Table1, CALCULATE ( COUNT ( Table1[Task] ), ALLSELECTED ( Table1[Group] ) ) = 2 ) ) + 0 VAR count_of_task_XYZ = CALCULATE ( DISTINCTCOUNT ( 'Table1'[Task] ), 'Table1'[Group] = firstSelectedGroup ) + 0 RETURN DIVIDE ( count_of_overlap, count_of_task_XYZ, 0 )Regards
NuTek
9 years agoFrequent Visitor
Thanks for the fast reply :)
The number I'm looking for is the number of "2"'s in the "Overlap" column divided by the number of rows with a "1" in the Group columns. ex: Group XYZ has 4 tasks (A,C,D,E) with 3 tasks appearing in both Group XYZ and PDQ (there are 3 columns in Overlap with a "2")
Will try yo play with the solution you provided.
Thanks!