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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Performance issue when converting MDX to DAX queries

Hi all, I have a MDX query which I want to convert to DAX to improve performance, however the result is not as expected, MDX took 11 secs to complete while DAX was 34 secs. any suggestion to improve the DAX query
 

MDX Query:

SELECT
{
    [Measures].[Internet Total Sales]
} ON COLUMNS,
ORDER(
    NONEMPTY
    (
        {
            [Product].[Model Name].[Model Name].AllMembers *
            [Product].[Product Line].[Product Line].AllMembers *
            [Product].[Product Name].[Product Name].AllMembers *
            [Customer].[First Name].[First Name].AllMembers *
            [Customer].[Last Name].[Last Name].AllMembers
        },
        {
            [Measures].[Internet Total Sales]
        }
    ),
    [Product].[Model Name].CurrentMember.MemberValue, ASC
) ON ROWS
FROM [Model]

DAX Query:

EVALUATE
CALCULATETABLE 
(
    FILTER
    (
        SUMMARIZE
        (
            CROSSJOIN('Product', 'Customer'),
            [Model Name],
            [Product Line],
            [Product Name],
            [First Name],
            [Last Name],
            "Internet Total Sales",
            [Internet Total Sales]
        ),
        NOT ISBLANK([Internet Total Sales])
    )
)
ORDER BY [Model Name] ASC

Thank you.

1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Hi @Anonymous 

 

The DAX function SUMMARIZECOLUMNS should be the most efficient way of doing this.

 

Try this (hopefully I got the table/column references correct):

 

 

EVALUATE
SUMMARIZECOLUMNS ( 
    'Product'[Model Name],
    'Product'[Product Line],
    'Product'[Product Name],
    'Customer'[First Name],
    'Customer'[Last Name],
    "Internet Total Sales", [Internet Total Sales]
)
ORDER BY 'Product'[Model Name] ASC

 

 

By default, SUMMARIZECOLUMNS will exclude any rows where all expressions evaluate to BLANK.

Also, SUMMARIZECOLUMNS is the function generally used by DAX queries generated by Power BI visuals.

 

Does this query perform better?

 

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

View solution in original post

3 REPLIES 3
srk_powerbi
Helper II
Helper II

@Anonymous  how did you convert from MDX to DAX query? or did you just write a DAX query from scratch?

OwenAuger
Super User
Super User

Hi @Anonymous 

 

The DAX function SUMMARIZECOLUMNS should be the most efficient way of doing this.

 

Try this (hopefully I got the table/column references correct):

 

 

EVALUATE
SUMMARIZECOLUMNS ( 
    'Product'[Model Name],
    'Product'[Product Line],
    'Product'[Product Name],
    'Customer'[First Name],
    'Customer'[Last Name],
    "Internet Total Sales", [Internet Total Sales]
)
ORDER BY 'Product'[Model Name] ASC

 

 

By default, SUMMARIZECOLUMNS will exclude any rows where all expressions evaluate to BLANK.

Also, SUMMARIZECOLUMNS is the function generally used by DAX queries generated by Power BI visuals.

 

Does this query perform better?

 

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn
Anonymous
Not applicable

Hi @OwenAuger , it helped me to reduce the query time from 34 secs to 2 secs by using SUMMARIZECOLUMNS, thanks a lot.

 

Regards,

Nhon

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.