Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Count the matching codes used in one table with other tables: Count the matching

Hi PowerBiers, I need you superior brain power!

 

 

I have a set of codes; Skills, Industries that are associated to People looking for jobs and those looking to hire people, as well as the job records and Organisations. 

 

Below three examples tables;

 

 

CompanyCode TypeCode CandidateCode TypeCode JobCode TypeCode
BTSkillsJAVA John SmithSkillsJAVA DeveloperSkillsJAVA
BTSkills.NET John SmithSkills.NET DeveloperSkills.NET
BTIndustryTelecoms John SmithIndustryTelecoms DeveloperIndustryTelecoms
    John SmithSkillsSQL DeveloperSkillsVBA

 

I need to represent in a table that totals these matches on codes and then show whether a sales/activity transaction has occurred. 

 

 CandidateContacts/Contact with an action related to personJobsCompanies
John Smith 50/525/1015/5
Joe Bloggs45/4010/05/5

 

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @Anonymous,

 

You can refer to below steps to create the summary table if it suitable for your requirement:

 

Steps:

1. Summary three table and add the tag.

Summary= UNION(SELECTCOLUMNS(Sheet2,"Type","Company","Name",[Company],"Code",[Code Type]&" "&[Code]),SELECTCOLUMNS(Sheet3,"Type","Candidate","Name",[Candidate],"Code",[Code Type]&" "&[Code]),SELECTCOLUMNS(Sheet4,"Type","Job","Name",[Job],"Code",[Code Type]&" "&[Code]))

2.PNG

 

 

2. Use var function to store the above table, and add variables to log the table count.

Summary = 
var temp= UNION(SELECTCOLUMNS(Sheet2,"Type","Company","Name",[Company],"Code",[Code Type]&" "&[Code]),SELECTCOLUMNS(Sheet3,"Type","Candidate","Name",[Candidate],"Code",[Code Type]&" "&[Code]),SELECTCOLUMNS(Sheet4,"Type","Job","Name",[Job],"Code",[Code Type]&" "&[Code]))
var Contacts=COUNTROWS(FILTER(temp,[Type]="Candidate"))
var Company=COUNTROWS(FILTER(temp,[Type]="Company"))
var Job=COUNTROWS(FILTER(temp,[Type]="Job"))
return
temp

3.PNG

 

 

3. Summary temp table and calculate the count.

Summary = 
var temp= UNION(SELECTCOLUMNS(Sheet2,"Type","Company","Name",[Company],"Code",[Code Type]&" "&[Code]),SELECTCOLUMNS(Sheet3,"Type","Candidate","Name",[Candidate],"Code",[Code Type]&" "&[Code]),SELECTCOLUMNS(Sheet4,"Type","Job","Name",[Job],"Code",[Code Type]&" "&[Code]))
var Contacts=COUNTROWS(FILTER(temp,[Type]="Candidate"))
var Company=COUNTROWS(FILTER(temp,[Type]="Company"))
var Job=COUNTROWS(FILTER(temp,[Type]="Job"))
return
SUMMARIZE(FILTER(temp,[Type]="Candidate"),[Name],
    "Current Contacts/All",COUNTROWS(FILTER(temp,[Name]=EARLIER([Name])))&"/"&Contacts,
    "Suitable Job/All",COUNTROWS(INTERSECT(SELECTCOLUMNS(FILTER(temp,[Type]="Candidate"&&[Name]=EARLIER([Name])),"Code",[Code]), SELECTCOLUMNS(FILTER(temp,[Type]="Job"),"Code",[Code])))&"/"&Job,
    "Suitable Company/All",COUNTROWS(INTERSECT(SELECTCOLUMNS(FILTER(temp,[Type]="Candidate"&&[Name]=EARLIER([Name])),"Code",[Code]), SELECTCOLUMNS(FILTER(temp,[Type]="Company"),"Code",[Code])))&"/"&Company
    )

4.PNG

 

 

Notice: the company count means the suitable company records count.(not the unique value)

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

1 REPLY 1
v-shex-msft
Community Support
Community Support

Hi @Anonymous,

 

You can refer to below steps to create the summary table if it suitable for your requirement:

 

Steps:

1. Summary three table and add the tag.

Summary= UNION(SELECTCOLUMNS(Sheet2,"Type","Company","Name",[Company],"Code",[Code Type]&" "&[Code]),SELECTCOLUMNS(Sheet3,"Type","Candidate","Name",[Candidate],"Code",[Code Type]&" "&[Code]),SELECTCOLUMNS(Sheet4,"Type","Job","Name",[Job],"Code",[Code Type]&" "&[Code]))

2.PNG

 

 

2. Use var function to store the above table, and add variables to log the table count.

Summary = 
var temp= UNION(SELECTCOLUMNS(Sheet2,"Type","Company","Name",[Company],"Code",[Code Type]&" "&[Code]),SELECTCOLUMNS(Sheet3,"Type","Candidate","Name",[Candidate],"Code",[Code Type]&" "&[Code]),SELECTCOLUMNS(Sheet4,"Type","Job","Name",[Job],"Code",[Code Type]&" "&[Code]))
var Contacts=COUNTROWS(FILTER(temp,[Type]="Candidate"))
var Company=COUNTROWS(FILTER(temp,[Type]="Company"))
var Job=COUNTROWS(FILTER(temp,[Type]="Job"))
return
temp

3.PNG

 

 

3. Summary temp table and calculate the count.

Summary = 
var temp= UNION(SELECTCOLUMNS(Sheet2,"Type","Company","Name",[Company],"Code",[Code Type]&" "&[Code]),SELECTCOLUMNS(Sheet3,"Type","Candidate","Name",[Candidate],"Code",[Code Type]&" "&[Code]),SELECTCOLUMNS(Sheet4,"Type","Job","Name",[Job],"Code",[Code Type]&" "&[Code]))
var Contacts=COUNTROWS(FILTER(temp,[Type]="Candidate"))
var Company=COUNTROWS(FILTER(temp,[Type]="Company"))
var Job=COUNTROWS(FILTER(temp,[Type]="Job"))
return
SUMMARIZE(FILTER(temp,[Type]="Candidate"),[Name],
    "Current Contacts/All",COUNTROWS(FILTER(temp,[Name]=EARLIER([Name])))&"/"&Contacts,
    "Suitable Job/All",COUNTROWS(INTERSECT(SELECTCOLUMNS(FILTER(temp,[Type]="Candidate"&&[Name]=EARLIER([Name])),"Code",[Code]), SELECTCOLUMNS(FILTER(temp,[Type]="Job"),"Code",[Code])))&"/"&Job,
    "Suitable Company/All",COUNTROWS(INTERSECT(SELECTCOLUMNS(FILTER(temp,[Type]="Candidate"&&[Name]=EARLIER([Name])),"Code",[Code]), SELECTCOLUMNS(FILTER(temp,[Type]="Company"),"Code",[Code])))&"/"&Company
    )

4.PNG

 

 

Notice: the company count means the suitable company records count.(not the unique value)

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.