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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
hoosha_11
Helper I
Helper I

Improve loading speed of the visuals (DAX query)

Hi,
 
There is a matrix with several columns, and according to the performance analyzer, the DAX query takes 2 seconds to load. But, when I add the query below to the visual level filter, the loading time for the visual increases to 8 seconds. Do you have any suggestions for improving the matrix's loading performance?
 
Order_Count =
CALCULATE (
    COUNT(Orders[Id]),
    USERELATIONSHIP ( Products[Inspection_EndDate], 'Dim-Date'[Date] ),
    USERELATIONSHIP(UserProfiles[AccountId__UID], Operators[AccountId__UID])
)
2 ACCEPTED SOLUTIONS
Shravan133
Super User
Super User

Hi,

 

try using a variable.

Order_Count_Optimized =
VAR OrdersCount =
CALCULATE (
COUNT(Orders[Id]),
USERELATIONSHIP ( Products[Inspection_EndDate], 'Dim-Date'[Date] ),
USERELATIONSHIP(UserProfiles[AccountId__UID], Operators[AccountId__UID])
)
RETURN
OrdersCount

View solution in original post

Anonymous
Not applicable

Hi @hoosha_11 ,

 

You can try storing intermediate results in variables. This approach reduces the number of calculations and thus improves performance. You can modify your formula like below:

Order_Count = 
VAR InspectionEndDate = 
    CALCULATE (
        COUNT(Orders[Id]),
        USERELATIONSHIP ( Products[Inspection_EndDate], 'Dim-Date'[Date] )
    )
VAR AccountIdRelationship = 
    CALCULATE (
        COUNT(Orders[Id]),
        USERELATIONSHIP(UserProfiles[AccountId__UID], Operators[AccountId__UID])
    )
RETURN
    InspectionEndDate + AccountIdRelationship

 

Also i tried formula provided by @Shravan133 . You can refer to below result:

vkongfanfmsft_0-1721962476290.png

 

Best Regards,
Adamk Kong

 

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

 

 

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @hoosha_11 ,

 

You can try storing intermediate results in variables. This approach reduces the number of calculations and thus improves performance. You can modify your formula like below:

Order_Count = 
VAR InspectionEndDate = 
    CALCULATE (
        COUNT(Orders[Id]),
        USERELATIONSHIP ( Products[Inspection_EndDate], 'Dim-Date'[Date] )
    )
VAR AccountIdRelationship = 
    CALCULATE (
        COUNT(Orders[Id]),
        USERELATIONSHIP(UserProfiles[AccountId__UID], Operators[AccountId__UID])
    )
RETURN
    InspectionEndDate + AccountIdRelationship

 

Also i tried formula provided by @Shravan133 . You can refer to below result:

vkongfanfmsft_0-1721962476290.png

 

Best Regards,
Adamk Kong

 

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

 

 

 

Shravan133
Super User
Super User

Hi,

 

try using a variable.

Order_Count_Optimized =
VAR OrdersCount =
CALCULATE (
COUNT(Orders[Id]),
USERELATIONSHIP ( Products[Inspection_EndDate], 'Dim-Date'[Date] ),
USERELATIONSHIP(UserProfiles[AccountId__UID], Operators[AccountId__UID])
)
RETURN
OrdersCount

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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