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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
GillyGils
Frequent Visitor

Converting MDX to DAX Measures

Hi All,

First time posting and hoping the community would be able to help me out or point me in the right direction with this. I'm converting a few Measures from a Multidimensional to a Tabular model. I'm getting a bit lost in this converison process of this particular measure.

 

Theres a custom table 'Seasons' with 2 values from the Multidimensonal model that has no joins to the 'Measures' Fact table but it is binding the measures of the fact table using MDX via Calculations in the Multidimensonal. The expression is:

Case

When

[Seasons Dimension].[Seasonality].CurrentMember IS [Seasons Dimension].[Seasonality].&[2.]

Then ROUND([Measures].[Seasons_Count_1]) Else [Measures].[Seasons_Count_2]

End

 

I was wondering if this type of MDX query can be converted to DAX?

 

Cheers

1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi, @GillyGils ;

Try it.

measure =
IF (
    'Seasons'[Seasonality] = 2,
    ROUND ( [Seasons_Count_1], 0 ),
    [Seasons_Count_2]
)

If it is not correct, can you screenshot the simple data in your powerbi and the result you want to output?
Best Regards,
Community Support Team _ Yalan Wu
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

3 REPLIES 3
GillyGils
Frequent Visitor

Thank you for your input guys. Got myself confused at looking at SelectedMeasures & Haseonvalues 😑 This is the final formula I used to get my desired results:

Measure_Test = IF(SELECTEDVALUE('Seasons'[Seasonaility]) = 2, ROUND(SUM([Season_Count_1),0),
[Seasons_Count_2]))

I will need to use the SWITCH function in over statements but this was a good base for me. Only really starting to getting the hang of DAX. Thanks for the help!

v-yalanwu-msft
Community Support
Community Support

Hi, @GillyGils ;

Try it.

measure =
IF (
    'Seasons'[Seasonality] = 2,
    ROUND ( [Seasons_Count_1], 0 ),
    [Seasons_Count_2]
)

If it is not correct, can you screenshot the simple data in your powerbi and the result you want to output?
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

lbendlin
Super User
Super User

the measures of the fact table

That's not really a thing in Power BI (Host table notwithstanding).  You can use a similar SWITCH statement to change the measure logic based on an input value.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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