Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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.
Solved! Go to Solution.
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.
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.
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.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 39 | |
| 37 | |
| 33 | |
| 32 | |
| 29 |
| User | Count |
|---|---|
| 132 | |
| 88 | |
| 82 | |
| 68 | |
| 64 |