cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
khalilliraqui Frequent Visitor
Frequent Visitor

Counting using related tables

I have three tables related to each others (two tables many-to-many) : lets take this as an example 

A person has many resources

power bi.png

I wanted to count for example : for every resource the number of people who has this resource, with a special condition on person for example firstname starts with "j".

I try many functions like filter or others but theese function only filter into the same table.

how can i use join on couting ?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support Team
Community Support Team

Re: Counting using related tables

Hi khalilliraqui,

 

According to your description, you want to get the count of resource owner persons which first name start with “j”?

 

If as I said, you can follow below steps):

 

  1.  Create sample table, ‘Person’, ’Personal Source’ , ‘Resource Type’.

‘Person’:

Capture.PNG

’Personal Source’:

 Capture2.PNG

‘Resource Type’:

 Capture3.PNG

  1. Write the Dax formula of requirement:

 

Recoure Count of Person Start with 'j' = DISTINCT( SELECTCOLUMNS('Personal Source',"Resource Type",RELATED('Resource Type'[Name]),"Count",COUNTX(FILTER('Personal Source','Personal Source'[Resource Type ID]=EARLIER('Personal Source'[Resource Type ID])&& LEFT(RELATED(Person[First Name]))="j"),'Personal Source'[Person ID])))

 

 Capture4.PNG

 

Reference:

LEFT Function (DAX)

RELATED Function (DAX)

 

Regards,

Xiaoxin Sheng

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



For learning resources/Release notes, please visit: | |

View solution in original post

1 REPLY 1
Highlighted
Community Support Team
Community Support Team

Re: Counting using related tables

Hi khalilliraqui,

 

According to your description, you want to get the count of resource owner persons which first name start with “j”?

 

If as I said, you can follow below steps):

 

  1.  Create sample table, ‘Person’, ’Personal Source’ , ‘Resource Type’.

‘Person’:

Capture.PNG

’Personal Source’:

 Capture2.PNG

‘Resource Type’:

 Capture3.PNG

  1. Write the Dax formula of requirement:

 

Recoure Count of Person Start with 'j' = DISTINCT( SELECTCOLUMNS('Personal Source',"Resource Type",RELATED('Resource Type'[Name]),"Count",COUNTX(FILTER('Personal Source','Personal Source'[Resource Type ID]=EARLIER('Personal Source'[Resource Type ID])&& LEFT(RELATED(Person[First Name]))="j"),'Personal Source'[Person ID])))

 

 Capture4.PNG

 

Reference:

LEFT Function (DAX)

RELATED Function (DAX)

 

Regards,

Xiaoxin Sheng

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



For learning resources/Release notes, please visit: | |

View solution in original post

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 46 members 1,105 guests
Please welcome our newest community members: