Forum Discussion
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
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.
3 Replies
- lbendlin
Super User
the measures of the fact tableThat'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.
- v-yalanwu-msft
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. - GillyGilsFrequent 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!