cancel
Showing results for 
Search instead for 
Did you mean: 
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
November 2022 Update

Check it Out!

Click here to read more about the November 2022 updates!

Power BI Dev Camp Session 27

Ted's Dev Camp

This session walks through creating a new Azure AD B2C tenant and configuring it with user flows and custom policies.

Health and Life Sciences Power BI User Group

Health and Life Sciences Power BI User Group

Power BI specialists at Microsoft have created a community user group where customers in the provider, payor, pharma, health solutions, and life science industries can collaborate.