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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
DJGPG
Regular Visitor

need help!

Hello, I have 2 source tables.  Table 1 is a comprehensive list of companies (each record is a company), and Table 2 is a list of individuals, their companies, and survey results for that individual (each record is an individual).  I've linked the two tables with a company ID, and in a matrix I'm able to show aggregrated survey results for each company that has participated (some companies in Table 1 have not participated and are not found in Table 2).  In this matrix, I'm also showing companies that have not participated, by selecting 'Show items with no data'.  My goal is to show the % of companies that have participated, either a measure in a card or another visual showing % participated vs. % not.  Example:

 

Company# Completions
A 
B3
C 
D4
E 
F2
G3

 

The metric should result as 57%, 4 out of 7.

Please help! I can't figure this out!

1 ACCEPTED SOLUTION

@DJGPG ,

Suggest you create a new Calculated Column in Table 2 (your Survey table):

 

KeyCompany = RELATED( DIM_Company[CompanyID] )

 

My table DIM_Company is your Table 1 (Master Key Companies)

If the Company ID is in that table, it will appear, else will appear as Blank.

 

Then do a DISTINCTCount on this new column.  This will exclude unwanted companies.

KeyCompanies = Calculate( DISTINCTCOUNT( Surveys[KeyCompany] ),
                  FILTER( Surveys, Surveys[KeyCompany] <> BLANK() ))

rsbin_1-1696025829559.png

Hope this works for you.

Regards,

View solution in original post

5 REPLIES 5
DJGPG
Regular Visitor

Hi, thanks!!  I'm making progres, but Table 2 (survey results) contains companies that are not part of the key companies list in Table 1 (comprehensive list of key companies). 

 

So the DISTINCTCOUNT measures are giving me full counts, which is great for Table 1 but for Table 2 the numerator needs to be only companies that are also found in Table 1.   Thanks again, this is hugely appreciated!!

@DJGPG ,

Suggest you create a new Calculated Column in Table 2 (your Survey table):

 

KeyCompany = RELATED( DIM_Company[CompanyID] )

 

My table DIM_Company is your Table 1 (Master Key Companies)

If the Company ID is in that table, it will appear, else will appear as Blank.

 

Then do a DISTINCTCount on this new column.  This will exclude unwanted companies.

KeyCompanies = Calculate( DISTINCTCOUNT( Surveys[KeyCompany] ),
                  FILTER( Surveys, Surveys[KeyCompany] <> BLANK() ))

rsbin_1-1696025829559.png

Hope this works for you.

Regards,

DJGPG
Regular Visitor

Wow, I think that worked, thank you so much!!!!!

So, is Table 1 your master list of companies? Meaning, any company in table 2 has to be in table 1. But not every company in table 1 appears in table 2, correct?

rsbin
Super User
Super User

@DJGPG ,

Use the DISTINCTCOUNT function.  I will demonstrate using 3 Measures:

1.  Calculate the unique number of Companies in your dataset:

Number of Companies = DISTINCTCOUNT( Table1[CompanyID])
   -- Using COUNTROWS instead should also give you the same result.

2.  Determine number of Companies that responded:

Number Companies Responded = DISTINCTCOUNT( Table2[CompanyID])

3. Then percentage responded:

%Response = DIVIDE( [Number Companies Responded],
                     [Number of Companies],
                   0 )

If you want, you can combine all of this into 1 Measure...I just split it so you can more easily see the method and know if your Measures are calculating accurately.

Hope this gets you going.

Regards,

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.