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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Jasonjm
New Member

DAX INNER JOIN query takes too long time to execute

Hello everyone,

 

I apologize in advance for the newbie question.

I created a simple dashboard that connects to Dynamics 365 Dataverse and queries accounts based on associated connections. Everything works fine but my query takes way too long to run (around 20 seconds). In the end, it is all about an INNER JOIN between the account and connection tables.

 

The data model is quite simple:

Jasonjm_0-1701169264362.png

 

I have created a 1:N relationship between account and connection tables:

Jasonjm_1-1701169286297.png

Am I right to create this relationship directly in the data model in order to avoid performing a NATURALINNERJOIN in the DAX query?

 

This is my DAX measure formula, that counts the number of account records where the connection role equals "RoleX":

CountRoleXAccounts = 
CALCULATE(
    COUNTROWS('account'),
    FILTER(
        'connection',
        'connection'[record1rolename] = "RoleX"
    )
)

This query works fine but takes about 20 seconds to return the result and it's less than 1000 records.

I imagine that this is not the right way to do it, and guess that the entire dataset of connection entity (around 15k records) is fetched several times.

 

Could you give me your advice please?

 

PS: This would be my SQL query equivalent

SELECT 
  COUNT(*) 
FROM 
  account 
  INNER JOIN connection ON account.accountid = connection.record1id 
WHERE 
  connection.record1rolename = 'RoleX'

This last query runs very quickly through SQL Server Management Studio.

1 REPLY 1
lbendlin
Super User
Super User

Those queries are not equivalent, especially when you have multiple record rows for each account.

 

You may want to look into SUMMARIZECOLUMNS or GROUPBY and then filter by role name later.

 

Use DAX Studio to examine your original query and then refactor based on your findings.

 

If you like more help, please provide sample data that fully covers your issue.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.