cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jsteffe
Helper III
Helper III

Inactive relationship

Hello,

I get the model below :

relationships.png

 

As there is one relationship between country and customer, the relationship between country and employees is not active.

So how can I get a table with total of employees and total of customers per country ?

Thanks

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@jsteffe , country should join to order details.

 

Or do you need to have merged tables -  Customer+country

and Employee and Country

View solution in original post

VahidDM
Super User
Super User

@jsteffe 

 

In addition to @amitchandak reply, you can use USERELATIONSHIP code.

 

https://www.sqlbi.com/articles/using-userelationship-in-dax/

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Appreciate your Kudos✌️!!

View solution in original post

4 REPLIES 4
VahidDM
Super User
Super User

@jsteffe 

 

In addition to @amitchandak reply, you can use USERELATIONSHIP code.

 

https://www.sqlbi.com/articles/using-userelationship-in-dax/

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Appreciate your Kudos✌️!!

I tried his formula and it works :

nb_employee_per_country = CALCULATE(count(Employee[EmployeeID]),USERELATIONSHIP(Countries[name],Employee[Country]))
 
Thanks
amitchandak
Super User
Super User

@jsteffe , country should join to order details.

 

Or do you need to have merged tables -  Customer+country

and Employee and Country

Merged table are a solution. Thanks

Helpful resources

Announcements
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Top Solution Authors