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
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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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