cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
daxbeginner Frequent Visitor
Frequent Visitor

MDX to Dax Code Migration

Hi,

 

I am struggling a bit to rewrite the below MDX code to DAX equivalent:

 

M1:
Iif(Isleaf([Invoice].[Invoice ID]),[Measures].[Product Invoice Amount EUR Days Due Date To Payment Date], SUM(Descendants([Invoice].[Invoice ID],,Leaves), [Measures].[Product Invoice Amount EUR Days Due Date To Payment Date]))

M2:
Iif(Isleaf([Invoice].[Invoice ID]),Int([Measures].[Invoiced Amount EUR]), Int(SUM(Descendants([Invoice].[Invoice ID],,Leaves), [Measures].[Invoiced Amount EUR])))

Result:
Iif([Measures].[M2],[Measures].[M1]/M2,null)

 

Any help is really appreciated.

Thanks in Advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: MDX to Dax Code Migration

Hi @daxbeginner ,

Maybe you can try this:

M1:

=
IF (
    ISFILTERED ( 'Invoice'[Invoice ID] ),
    [Product Invoice Amount EUR Days Due Date To Payment Date],
    SUMX (
        ALLEXCEPT ( 'Invoice', 'Invoice'[Your Level Column] ),
        [Product Invoice Amount EUR Days Due Date To Payment Date]
    )
)

M2:

=
IF (
    ISFILTERED ( 'Invoice'[Invoice ID] ),
    INT ( [Invoiced Amount EUR] ),
    INT (
        SUMX (
            ALLEXCEPT ( 'Invoice', 'Invoice'[Your Level Column] ),
            [Invoiced Amount EUR]
        )
    )
)

Best Regards,
Icey

 

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
Community Support Team
Community Support Team

Re: MDX to Dax Code Migration

Hi @daxbeginner ,

I don't know much about the DXA language. Maybe you can refer to this article: Converting MDX to DAX.

 

Best Regards,
Icey

 

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

Community Support Team
Community Support Team

Re: MDX to Dax Code Migration

Hi @daxbeginner ,

Maybe you can try this:

M1:

=
IF (
    ISFILTERED ( 'Invoice'[Invoice ID] ),
    [Product Invoice Amount EUR Days Due Date To Payment Date],
    SUMX (
        ALLEXCEPT ( 'Invoice', 'Invoice'[Your Level Column] ),
        [Product Invoice Amount EUR Days Due Date To Payment Date]
    )
)

M2:

=
IF (
    ISFILTERED ( 'Invoice'[Invoice ID] ),
    INT ( [Invoiced Amount EUR] ),
    INT (
        SUMX (
            ALLEXCEPT ( 'Invoice', 'Invoice'[Your Level Column] ),
            [Invoiced Amount EUR]
        )
    )
)

Best Regards,
Icey

 

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

Helpful resources

Announcements
Exclusive LIVE Community Event #3 – Ask Arun Anything

Exclusive LIVE Community Event #3 – Ask Arun Anything

Join us in the third Triple A event!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors